Conversation
When the chipflow API rejects /auth/github-token with
{"error":"missing_email", ...}, it means the gh CLI token is missing
the user:email scope and the server can't fetch a verified email.
Previously the lib just printed the generic "GitHub token authentication
failed: ..." message and silently fell through to device flow (which
then expires in non-interactive contexts). The user had no signal that
their gh token needs a one-line refresh.
Now we detect the specific error code and print:
💡 Your `gh` CLI token is missing the `user:email` scope.
Run this once and retry:
gh auth refresh -s user:email
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
When the chipflow API's
/auth/github-tokenendpoint returns 400 with{"error": "missing_email"}, it means the gh CLI's token is missing theuser:emailscope, so the server can't fetch a verified email and refuses to issue an API key.The current code just prints the generic "GitHub token authentication failed: ..." message and silently falls through to device flow. In non-interactive contexts that flow then expires after a few minutes, leaving the user with no idea what was wrong or how to fix it.
This was the actual confusion that took ~30 minutes to diagnose during the bundle.zip rollout today. Past
chipflow silicon submitinvocations had worked fine because that gh token had the scope; a latergh auth refresh(or VS Code re-auth) silently dropped it.Change
Detect the specific
missing_emailerror code inauthenticate_with_github_tokenand print:Generic-error path unchanged.
Test plan
gh auth refresh -s user:emailfixes the situation; this just makes that finding actionable for future users.