GitHub CLI troubleshooting
Fix a refused token, a missing profile, an unfinished sync or a repository the GitHub CLI cannot see.
A sign-in failed, a sync stopped, or your agent cannot find an issue you know is there. Most of these take one step to fix, and the error message names that step. This page helps you find your case, fix it and check that it works again.
gthb doctor shows what is set up without connecting to GitHub, and gthb work session status --check asks GitHub
whose token the profile has. Start there when you do not know what is wrong.
On this page:
What happened
- The token is the wrong kind, or it ended.
gthbtakes only a fine-grained token, and GitHub stops one on its expiry date or when you delete it. - The token cannot see a repository. It was made for other repositories, or another owner, or without one of the four read permissions.
- The command has no profile. A profile is a name you choose for one GitHub owner, and a command that uses an account never guesses one.
- The copy is not complete yet. A large first sync stops before its time limit and goes on at the next run.
- GitHub asked to slow down, or a repository moved.
Ways to fix it
Find what you see in the table, do what its row says, then run the command again.
| What you see | What to do |
|---|---|
gthb is not found | Open a new terminal, and check that npm's global folder is on PATH. |
| "name a profile" | Put the profile first, as in gthb work issues list, or set GTHB_PROFILE=work. A new profile starts with gthb work session start --owner octo-org. |
| "no profile named work on this computer" | That profile has never signed in. Run gthb work session start --owner octo-org, or use a profile from the list the error prints. |
| "work is not signed in" | Run gthb work session start --owner octo-org and paste the token. |
| "give the owner whose data the token reads" | Add --owner with the user or organization you chose as the token's resource owner. |
| "this is not a fine-grained personal access token" | You pasted a classic or OAuth token. Make a fine-grained, read-only token and sign in again. |
GitHub stops taking the token after it worked before (authentication_error) | The token expired or was deleted, or the organization revoked it. Make a new one, then run gthb work session start --owner octo-org again. |
"work reads octo-org's repositories" | One profile reads one owner. Sign another profile in for the other owner, as the message shows. |
repos add says the repository is not found | The repository name has a typo, or the token has no access to it. Add the repository to the token's Repository access on GitHub. |
| "moved or was renamed on GitHub" | Run repos add with the repository's new name. |
| "copies no repository yet" | Choose one first: gthb work repos add octo-org/app, then gthb work sync. |
"does not copy octo-org/app" | gthb work repos list shows the names the profile copies. |
| An issue is missing or out of date | Run gthb work sync until its answer says complete: true. A sync that stopped early goes on from where it stopped. |
The sync answer lists a repository under gaps | GitHub refused that repository: the token cannot read it, or it is gone or moved. The other repositories are synced. Fix the token's access, then sync again. |
The sync answer says complete: false and lists an issue with source: "code" | The part that copies pull requests, commits and releases failed, and the issue's reason says why. The issues and READMEs of that run are saved. Run sync again. |
repos show says the README is missing | The repository has no README, or the token lacks the Contents permission. |
"GitHub's rate limit for this token is spent" (rate_limited) | GitHub's limit for this token is spent. Your own gh and other tools share it. Wait, then run the command again. |
A command is refused although GitHub would allow it (permission_error) | The profile's permissions stop the command, and the message names the key. See settings. |
doctor lists config.issues | The settings file has a mistake. Run the config unset each issue gives, gthb config repair, or fix the file by hand. |
doctor lists files.problems | Other users of the computer can read the settings. Run each chmod that doctor prints after "to make it private:". doctor never changes a file mode itself. |
Check that it is fixed
Run gthb doctor and gthb work session status --check, then the command that failed. When they work, you are done.
If it still fails, open an issue in the repository with the error
code and what you ran. gthb doctor reports create writes a problem report you can attach, and
gthb doctor reports show shows what it holds first. Never paste a token, a password or private content into an
issue.
Error codes
With --json, an error is one JSON value on stderr: a code to branch on, a reason that names the case and a
message. The command reference lists every code with its exit code.