jdx/mise · error

no GitHub token found for

Error message

no GitHub token found for {}

What it means

`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.

Solutions

  1. Export a token: export GITHUB_TOKEN=ghp_... (or MISE_GITHUB_TOKEN) before running
  2. Configure the token persistently via mise settings for the host
  3. Drop --raw if a human-readable '(none)' answer is acceptable and branch on it in your script
  4. Verify the host argument matches the host the token is stored under (github.com vs custom GHES hostname)

Example fix

// before (script)
tok=$(mise token github --raw)
// after
tok=$(mise token github --raw) || { echo "no token configured" >&2; exit 1; }
Defensive patterns

Strategy: try-catch

Validate before calling

const tok = process.env.GITHUB_TOKEN || process.env.MISE_GITHUB_TOKEN;
if (!tok) { console.error('no GitHub token configured; set GITHUB_TOKEN'); process.exit(1); }

Type guard

const hasGithubToken = (): boolean =>
  Boolean(process.env.GITHUB_TOKEN ?? process.env.MISE_GITHUB_TOKEN);

Try / catch

try { tok = exec('mise token github --raw'); } catch (e) { if (String(e).includes('no GitHub token found')) { tok = fallback; } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/d15be5837ccd7123. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/token/github.rs:92

        } else {
            github::resolve_token(&self.host)
        };
        match resolved {
            Some((token, source)) => {
                if self.raw {
                    miseprintln!("{token}");
                    return Ok(());
                }
                let display_token = if self.unmask {
                    token
                } else {
                    tokens::mask_token(&token)
                };
                miseprintln!("{}: {} (source: {})", self.host, display_token, source);
            }
            None => {
                if self.raw {
                    bail!("no GitHub token found for {}", self.host);
                }
                miseprintln!("{}: (none)", self.host);
            }
        }
        Ok(())
    }
}

View on GitHub (pinned to 533346cc37)