jdx/mise · error

GitHub OAuth is not configured. Set github.oauth_client_id f

Error message

GitHub OAuth is not configured. Set github.oauth_client_id first.

What it means

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.

Source

Thrown at src/github/oauth.rs:238

                warn!("failed to invalidate GitHub OAuth token cache: {err:#}");
            }
        }
        return Ok(None);
    };
    let access_token = refreshed.access_token.clone();
    cache.tokens.insert(cache_key.to_string(), refreshed);
    if let Err(err) = write_cache_locked_async(cache_lock, cache).await {
        warn!("failed to cache refreshed GitHub OAuth token: {err:#}");
    }
    Ok(Some(access_token))
}

async fn token_async(req: TokenRequest) -> Result<String> {
    let settings = Settings::get();
    let client_id = settings.github.oauth_client_id.trim();
    let scopes = settings.github.oauth_scopes.trim();
    if client_id.is_empty() {
        bail!("GitHub OAuth is not configured. Set github.oauth_client_id first.");
    }
    if !host_matches_settings(&req.host, &settings.github.oauth_api_url) {
        bail!(
            "GitHub OAuth is configured for {}, not {}",
            api_host(&settings.github.oauth_api_url).unwrap_or_else(|| "unknown host".to_string()),
            req.host
        );
    }

    let canonical_host =
        api_host(&settings.github.oauth_api_url).unwrap_or_else(|| req.host.clone());
    let cache_key = cache_key(&canonical_host, client_id, scopes);
    let cache = read_cache_async().await?;
    if !req.force_refresh
        && let Some(cached) = cache.tokens.get(&cache_key)
        && reusable(cached)
    {
        return Ok(cached.access_token.clone());

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Set github.oauth_client_id in mise settings (mise settings set github.oauth_client_id <id> or edit ~/.config/mise/settings.toml).
  2. Add github.oauth_scopes if the intended flow requires specific scopes.
  3. Alternatively use a classic PAT via GITHUB_TOKEN / MISE_GITHUB_TOKEN if the code path supports it, avoiding OAuth entirely.
  4. Re-run the command after configuring; tokens are then fetched and cached.

Example fix

# before: ~/.config/mise/settings.toml
[settings]
# no github section
// after
[github]
oauth_client_id = "Iv1.xxxxxxxxxxxxxxxx"
oauth_scopes = "gist,repo"
Defensive patterns

Strategy: validation

Validate before calling

// before calling token()
const settings = await getSettings();
if (!settings.github?.oauth_client_id?.trim()) throw new Error('set github.oauth_client_id before requesting a GitHub OAuth token');

Try / catch

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; }

Prevention

When it happens

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

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

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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