{"record":{"id":"d15be5837ccd7123","repo":"jdx/mise","slug":"no-github-token-found-for","errorCode":null,"errorMessage":"no GitHub token found for {}","messagePattern":"no GitHub token found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/token/github.rs","lineNumber":92,"sourceCode":"        } else {\n            github::resolve_token(&self.host)\n        };\n        match resolved {\n            Some((token, source)) => {\n                if self.raw {\n                    miseprintln!(\"{token}\");\n                    return Ok(());\n                }\n                let display_token = if self.unmask {\n                    token\n                } else {\n                    tokens::mask_token(&token)\n                };\n                miseprintln!(\"{}: {} (source: {})\", self.host, display_token, source);\n            }\n            None => {\n                if self.raw {\n                    bail!(\"no GitHub token found for {}\", self.host);\n                }\n                miseprintln!(\"{}: (none)\", self.host);\n            }\n        }\n        Ok(())\n    }\n}\n","sourceCodeStart":74,"sourceCodeEnd":100,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/token/github.rs#L74-L100","documentation":"`mise token github` with `--raw` prints just the GitHub token value. When no token exists for the requested host, raw mode has nothing to print and raises this error instead of printing the human-friendly '(none)' line used in non-raw mode.","triggerScenarios":"Running `mise token github --raw` (or `mise token github <host> --raw`) when no GitHub token is configured in mise settings/config or environment (GITHUB_TOKEN/MISE_GITHUB_TOKEN) for that host.","commonSituations":"Fresh machine or CI runner without GH_TOKEN/GITHUB_TOKEN exported; token configured for github.com but querying a GHES host; --raw flag left in a script after token removal.","solutions":["Export a token: export GITHUB_TOKEN=ghp_... (or MISE_GITHUB_TOKEN) before running","Configure the token persistently via mise settings for the host","Drop --raw if a human-readable '(none)' answer is acceptable and branch on it in your script","Verify the host argument matches the host the token is stored under (github.com vs custom GHES hostname)"],"exampleFix":"// before (script)\ntok=$(mise token github --raw)\n// after\ntok=$(mise token github --raw) || { echo \"no token configured\" >&2; exit 1; }","handlingStrategy":"try-catch","validationCode":"const tok = process.env.GITHUB_TOKEN || process.env.MISE_GITHUB_TOKEN;\nif (!tok) { console.error('no GitHub token configured; set GITHUB_TOKEN'); process.exit(1); }","typeGuard":"const hasGithubToken = (): boolean =>\n  Boolean(process.env.GITHUB_TOKEN ?? process.env.MISE_GITHUB_TOKEN);","tryCatchPattern":"try { tok = exec('mise token github --raw'); } catch (e) { if (String(e).includes('no GitHub token found')) { tok = fallback; } else throw e; }","preventionTips":["Export GITHUB_TOKEN or MISE_GITHUB_TOKEN in CI and shell profiles","Remember tokens are per-host; use the exact host when querying GHES","Prefer non-raw mode when 'none' is an acceptable outcome in automation"],"tags":["cli","github","token","authentication"],"backgroundTag":"missing-api-key","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}