"Failed to resolve custom headers" when host is configured through environment variable

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: 1.73.0
  • Operating system and version: macOS 26.0.1 (25A362)
  • Gitlab.com or self-managed instance? self-managed instance
  • GitLab version (if self-managed) GitLab version here (Use the version endpoint, like this: gitlab.my-company.com/api/v4/version)
  • I have performed glab auth status to check for authentication issues
  • Run the command in debug mode (like DEBUG=true glab mr list) and attach any useful output

Summary

this is a regression in 1.73.0 introduced by !2310 (merged)

I configure my GitLab host through environment variables $GITLAB_HOST, $GITLAB_USERNAME, $GITLAB_TOKEN etc.). Therefore my hosts config in /.config/glab-cli/config.yml is empty.

Environment

  • OS:
  • SHELL:
  • TERM:
  • GLAB:

Other:

Steps to reproduce

  • empty hosts in config.yaml

    # ...
    hosts: {} # configured through environment variables instead
  • export environment variables GITLAB_HOST=my.gitlab.instance.com

  • run glab repo view

What is the current bug behavior?

it does not work when hosts configuration is empty in ~/.config/glab-cli/config.yml

What is the expected correct behavior?

should work with host configured through $GITLAB_HOST environment variable. Same command works with previous release 1.72.0

Relevant logs and/or screenshots

ERROR

Failed to resolve custom headers: failed to parse hosts config: could not parse hosts config: could not find any host configurations.

Possible fixes

!2310 (diffs)

Edited by Salomon Popp