You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
auth status misreports an inaccessible keyring as an invalid token #14171
When gh runs in an environment without access to the user's graphical session (for example, a system daemon on macOS), reading the auth token from the keyring fails with a permission error. gh auth status then reports "The token in default is invalid" and suggests re-authenticating — but re-authenticating can never succeed, because the token also cannot be stored in the keyring from that environment.
Affected version
gh version 2.97.0 (2026-07-31)
Steps to reproduce the behavior
Log in to gh normally so the token is stored in the macOS keyring.
Run gh auth status from a context without access to the user's graphical session (e.g. a launchd system daemon, where launchctl managername reports System).
Observe the misleading error.
Expected vs actual behavior
Expected: gh auth status should report that the keyring is inaccessible and suggest a workaround that works in that environment (e.g. set GH_TOKEN or use gh auth login --insecure-storage).
Actual: it reports "The token in default is invalid" and suggests re-authenticating, which cannot succeed.
Logs
github.com
X Failed to log in to github.com account aimkiray (default)
- Active account: true
- The token in default is invalid.
- To re-authenticate, run: gh auth login -h github.com
- To forget about this account, run: gh auth logout -h github.com -u aimkiray
@cli/code-reviewers, I'd like to work on this if the proposed scope is welcome.
I traced the misleading output to the token lookup path: credential-store errors are discarded by ActiveToken, so auth status later tries to validate an empty token and renders the generic invalid-token message.
Proposed acceptance criteria:
When a configured account's credential-store lookup fails with an error other than "not found", gh auth status reports that the credential store is inaccessible rather than saying the token is invalid.
The output suggests usable alternatives for that environment, including GH_TOKEN and gh auth login --insecure-storage.
No token-validation request is made when credential retrieval itself failed.
Existing behavior for a genuinely missing or rejected token remains unchanged.
Unit tests cover the credential-store error path and the existing invalid-token path.
Could you confirm the acceptance criteria and add help wanted if this is suitable for an external contribution? I will not open a PR before then.
Activity
RRXXZZYY commentedon Sep 1, 2026
@cli/code-reviewers, I'd like to work on this if the proposed scope is welcome.
I traced the misleading output to the token lookup path: credential-store errors are discarded by
ActiveToken, soauth statuslater tries to validate an empty token and renders the generic invalid-token message.Proposed acceptance criteria:
gh auth statusreports that the credential store is inaccessible rather than saying the token is invalid.GH_TOKENandgh auth login --insecure-storage.Could you confirm the acceptance criteria and add
help wantedif this is suitable for an external contribution? I will not open a PR before then.feat: hand the vault's GitHub token to gh in a workspace