{"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":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cli/token/github.rs","lineNumber":66,"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\nstatic AFTER_LONG_HELP: &str = color_print::cstr!(\n    r#\"<bold><underline>Examples:</underline></bold>\n\n    $ <bold>mise token github</bold>\n    github.com: ghp_…xxxx (source: GITHUB_TOKEN)\n\n    $ <bold>mise token github --unmask</bold>\n    github.com: ghp_xxxxxxxxxxxx (source: GITHUB_TOKEN)\n\n    $ <bold>mise token github github.mycompany.com</bold>","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/token/github.rs#L48-L84","documentation":"`mise token github --raw` requires that a GitHub token actually exists for the requested --host; mise checked its token sources (e.g. GITHUB_TOKEN/GH_TOKEN-style env vars and `gh` CLI auth) and found none. Without --raw the same state just prints `host: (none)`, so the error is specific to --raw (and by extension piping --raw into another command).","triggerScenarios":"`mise token github --raw` with no token configured anywhere; `--raw --host github.example.com` where no enterprise token (GH_ENTERPRISE_TOKEN etc.) is set for that host.","commonSituations":"CI scripts consuming `mise token github --raw` before any credential step ran; using a custom GHE host without its enterprise token env var; fresh machine where `gh auth login` was never run.","solutions":["Export a token before the call: `export GITHUB_TOKEN=ghp_...` (or the enterprise variant for custom hosts) then rerun","Authenticate the gh CLI: `gh auth login` — mise reads its stored token","If you just want to inspect state, drop --raw: `mise token github` prints `(none)` instead of failing"],"exampleFix":"# before\n$ mise token github --raw\n# error: no GitHub token found for github.com\n\n# after\n$ export GITHUB_TOKEN=\"$MY_CI_TOKEN\"\n$ mise token github --raw","handlingStrategy":"validation","validationCode":": \"${GITHUB_TOKEN:?no GITHUB_TOKEN set — mise token github --raw would fail}\"\nmise token github --raw","typeGuard":null,"tryCatchPattern":"token=\"$(mise token github --raw)\" || { echo 'no GitHub token: export GITHUB_TOKEN or run gh auth login' >&2; exit 1; }","preventionTips":["Assert the token env var (or `gh auth status`) before any --raw consumption","For custom hosts set the matching enterprise token env var before invoking","Treat `mise token github` (no --raw) as the safe probe; it prints (none) instead of failing"],"tags":["mise","github","token","authentication","credentials","cli"],"backgroundTag":"missing-credentials","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}