{"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":"exception","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/533346cc374382b41ec5ff70536252b2e96e725c/src/github/oauth.rs#L220-L256","documentation":"mise's GitHub OAuth device-flow helper requires a registered OAuth application client id configured via the `github.oauth_client_id` setting. `token_async` refuses to start the flow (cached-token lookup, refresh, or device authorization) when no client id is set.","triggerScenarios":"Calling `mise token github` (or any code path reaching `token_async`, including `force_refresh`) without `github.oauth_client_id` set in settings.","commonSituations":"Fresh mise install without OAuth setup; settings only define `github.oauth_scopes` but not the client id; typo in the settings key; using a config profile that lacks the setting.","solutions":["Set `github.oauth_client_id` in settings: `mise settings set github.oauth_client_id <id>`","Register an OAuth app at https://github.com/settings/developers to obtain a client id (device flow grant type)","Check `mise settings get github.oauth_client_id` to confirm it is non-empty in the active profile","If you meant to use a plain token instead, set `GITHUB_TOKEN`/`MISE_GITHUB_TOKEN` rather than using the OAuth flow"],"exampleFix":"// before: only scopes configured\n[github]\noauth_scopes = \"repo gist\"\n// after\n[github]\noauth_client_id = \"Iv1.abc123def456\"\noauth_scopes = \"repo gist\"","handlingStrategy":"validation","validationCode":"mise settings get github.oauth_client_id || echo 'github.oauth_client_id is not set'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure github.oauth_client_id before using `mise token github`","Include the OAuth setup in onboarding docs and CI bootstrap scripts","Use a PAT env var (GITHUB_TOKEN) in environments where OAuth setup is not possible"],"tags":["github","oauth","configuration"],"backgroundTag":"missing-required-config-field","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"}