{"record":{"id":"e4596356382ef43f","repo":"jdx/mise","slug":"github-oauth-is-not-configured-set-github-oauth-c","errorCode":null,"errorMessage":"GitHub OAuth is not configured. Set github.oauth_client_id first.","messagePattern":"GitHub OAuth is not configured\\. Set github\\.oauth_client_id first\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github/oauth.rs","lineNumber":238,"sourceCode":"                warn!(\"failed to invalidate GitHub OAuth token cache: {err:#}\");\n            }\n        }\n        return Ok(None);\n    };\n    let access_token = refreshed.access_token.clone();\n    cache.tokens.insert(cache_key.to_string(), refreshed);\n    if let Err(err) = write_cache_locked_async(cache_lock, cache).await {\n        warn!(\"failed to cache refreshed GitHub OAuth token: {err:#}\");\n    }\n    Ok(Some(access_token))\n}\n\nasync fn token_async(req: TokenRequest) -> Result<String> {\n    let settings = Settings::get();\n    let client_id = settings.github.oauth_client_id.trim();\n    let scopes = settings.github.oauth_scopes.trim();\n    if client_id.is_empty() {\n        bail!(\"GitHub OAuth is not configured. Set github.oauth_client_id first.\");\n    }\n    if !host_matches_settings(&req.host, &settings.github.oauth_api_url) {\n        bail!(\n            \"GitHub OAuth is configured for {}, not {}\",\n            api_host(&settings.github.oauth_api_url).unwrap_or_else(|| \"unknown host\".to_string()),\n            req.host\n        );\n    }\n\n    let canonical_host =\n        api_host(&settings.github.oauth_api_url).unwrap_or_else(|| req.host.clone());\n    let cache_key = cache_key(&canonical_host, client_id, scopes);\n    let cache = read_cache_async().await?;\n    if !req.force_refresh\n        && let Some(cached) = cache.tokens.get(&cache_key)\n        && reusable(cached)\n    {\n        return Ok(cached.access_token.clone());","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/github/oauth.rs#L220-L256","documentation":"mise's GitHub OAuth device/app token flow reads github.oauth_client_id from settings. token_async bails early when no client id is configured, because it cannot start an OAuth token exchange without one. The error tells you exactly which setting to set.","triggerScenarios":"Calling token()/token_async() (or force_refresh_mints_new_token_despite_valid_cache) for GitHub auth while settings.github.oauth_client_id is unset or whitespace-only, and the code path requires an OAuth token (e.g. gists or OAuth-backed API calls).","commonSituations":"Fresh mise install without configuring github.oauth_client_id; settings.toml missing the [github] table; typo in the setting name; running with a cleaned/partial MISE_SETTINGS or a different config dir than usual; relying on GITHUB_TOKEN but hitting a code path that requires OAuth specifically.","solutions":["Set github.oauth_client_id in mise settings (mise settings set github.oauth_client_id <id> or edit ~/.config/mise/settings.toml).","Add github.oauth_scopes if the intended flow requires specific scopes.","Alternatively use a classic PAT via GITHUB_TOKEN / MISE_GITHUB_TOKEN if the code path supports it, avoiding OAuth entirely.","Re-run the command after configuring; tokens are then fetched and cached."],"exampleFix":"# before: ~/.config/mise/settings.toml\n[settings]\n# no github section\n// after\n[github]\noauth_client_id = \"Iv1.xxxxxxxxxxxxxxxx\"\noauth_scopes = \"gist,repo\"","handlingStrategy":"validation","validationCode":"// before calling token()\nconst settings = await getSettings();\nif (!settings.github?.oauth_client_id?.trim()) throw new Error('set github.oauth_client_id before requesting a GitHub OAuth token');","typeGuard":null,"tryCatchPattern":"try { const t = await githubToken(host); } catch (e) { if (String(e).includes('oauth_client_id')) { console.error('Configure github.oauth_client_id in mise settings, or use GITHUB_TOKEN instead'); } else throw e; }","preventionTips":["Configure github.oauth_client_id (and oauth_scopes) in settings.toml during setup","Prefer MISE_GITHUB_TOKEN/GITHUB_TOKEN for paths that accept a PAT and do not need OAuth","Check `mise settings get github.oauth_client_id` before workflows that need OAuth tokens","Avoid stripped/managed config dirs that omit the [github] table"],"tags":["github","oauth","config","authentication"],"backgroundTag":"missing-required-config-field","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}