fix(cli): surface GitHub API error details when skill download fails#2786
Merged
Conversation
…us rendering Closes #2363 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…hint Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
fahreddinozcan
approved these changes
Jun 17, 2026
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.
Problem
Closes #2363
ctx7 setupandctx7 setup --cliswallowed all GitHub API errors into a single opaque message:This made it impossible for users to self-diagnose whether the failure was a 403 rate-limit, a 401 bad/expired token, or a 404 wrong branch. Users with
GITHUB_TOKENalready set in their environment had no way to know their token was being accepted or rejected.The original missing
Authorizationheader bug was already fixed in source, but the unhelpful error messages kept users confused (see the ongoing thread in #2363).What changed
packages/cli/src/utils/github.tsextractGitHubError(response)— new private helper that reads the HTTP status and GitHub's JSON error body ({ message }) into a single descriptive string (e.g."HTTP 403: API rate limit exceeded for 1.2.3.4"). Both fetch helpers now use it instead of duplicating the logic.fetchRepoTree— returns{ error: string }with the full detail instead of barenull.fetchDefaultBranch— now also extracts the error body (previously discarded it). Returns{ error: string; status: number }so callers can distinguish a true 404 (repo not found) from a 403/429 rate-limit — both of which previously collapsed into the same silentrepo_not_foundresult.listSkillsFromGitHub— updated to propagate the richer error and only returnrepo_not_foundon HTTP 404.downloadSkillFromGitHub— appends an actionable hint when the request was unauthenticated and the status is 403/429:packages/cli/src/commands/setup.tslogSkillStatus(skillStatus, skillPath)— extracted shared helper that was copy-pasted identically in bothsetupMcpandsetupClirender loops. Both loops now call it in one line.✖icon with the error detail on its own sub-line, matching the style of the CLI flow'sspinner.fail(...):EACCESpermissions tip is now correctly guarded inside theskillFailedbranch.Test plan
ctx7 setupwith a valid token → skill installs, no change in happy path outputctx7 setupwith an expired/invalid token →✖ Skill failed+HTTP 401: Bad credentialsctx7 setup --cliwith no token, rate limited →✖ Failed to download find-docs skill: GitHub API error: HTTP 403: ... — set GITHUB_TOKEN env var to increase rate limitsctx7 setup --cliwithGITHUB_TOKENset → token is included in request, 403 hint does not appearctx7 skills install <skill>from a non-existent repo →repo_not_found(404 path unchanged)ctx7 skills install <skill>from a repo that triggers a 403 → surfaces the error string instead ofrepo_not_found🤖 Generated with Claude Code