Hmbown/CodeWhale · error

Codewhale-owned OAuth credentials are not configured

Error message

Codewhale-owned {} OAuth credentials are not configured

What it means

`get_owned_credentials_with` looks up the configured auth-file path for Codewhale-owned credentials of the given provider; when `configured_owned_auth_file_path` returns `None`, no owned credential storage is configured and it fails with the provider's display name. This only concerns Codewhale's own credential files, not imported external ones.

Solutions

  1. Run the provider's Codewhale-owned login (e.g. `codewhale auth xai-device`) to create/configure owned credentials.
  2. Check the config for the owned auth-file path setting for this provider and set it if absent.
  3. Verify you loaded the intended config profile/environment.

Example fix

// before
# config has no owned xAI auth path; codewhale reads owned creds -> bail
// after
$ codewhale auth xai-device   # configures Codewhale-owned xAI storage
Defensive patterns

Strategy: validation

Validate before calling

let configured = configured_owned_auth_file_path(provider, config);
if configured.is_none() {
    // run the provider's owned login (e.g. codewhale auth xai-device) first
}

Type guard

fn owned_credentials_configured(provider: OAuthProvider, config: &Config) -> bool {
    configured_owned_auth_file_path(provider, config).is_some()
}

Prevention

When it happens

Trigger: Calling `get_owned_credentials_with(provider, config, client)` when the config lacks the owned auth-file path for that provider — `configured_owned_auth_file_path(provider, config)` yields `None`.

Common situations: Fresh install where the user never ran the provider's device login; config file missing the owned-credentials path setting; wrong config profile loaded that doesn't define the provider's storage.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/512bf10ba464dd17. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/oauth.rs:2182

    Ok(get_xai_credentials(config)?.access_token)
}

/// Load ChatGPT owned credentials from the configured generation,
/// refreshing through the seam when stale.
pub fn get_owned_credentials(
    provider: OAuthProvider,
    config: &Config,
) -> Result<OwnedOAuthCredentials> {
    get_owned_credentials_with(provider, config, &ReqwestOAuthFormClient)
}

fn get_owned_credentials_with(
    provider: OAuthProvider,
    config: &Config,
    client: &dyn OAuthFormClient,
) -> Result<OwnedOAuthCredentials> {
    let Some(path) = configured_owned_auth_file_path(provider, config)? else {
        bail!(
            "Codewhale-owned {} OAuth credentials are not configured",
            oauth_provider_params(provider).display_name
        );
    };
    let name = path
        .file_name()
        .and_then(|name| name.to_str())
        .context("Codewhale-owned OAuth path must have a UTF-8 basename")?;
    codewhale_config::with_xai_oauth_lifecycle_lock(|store| {
        get_owned_credentials_locked(provider, store, name, |issuer, client_id, refresh| {
            refresh_for_provider(provider, client, issuer, client_id, refresh)
        })
    })
}

fn get_owned_credentials_at(provider: OAuthProvider, path: &Path) -> Result<OwnedOAuthCredentials> {
    let directory = codewhale_config::xai_oauth_credentials_dir()?;
    anyhow::ensure!(

View on GitHub (pinned to 73e0f67d83)