Hmbown/CodeWhale · error · anyhow::Error

Codewhale-owned xAI OAuth credentials were not found at {}.

Error message

Codewhale-owned xAI OAuth credentials were not found at {}. Run `codewhale auth xai-device` again.

What it means

Missing-credential error in get_owned_credentials_locked: the Codewhale-owned xAI OAuth auth file does not exist at the expected store path, so load_owned_auth_file_from_store returned None. The device-login flow was never completed or the file was deleted.

Source

Thrown at crates/tui/src/xai_oauth.rs:438

            || codewhale_config::is_valid_xai_oauth_generation(name),
        "Codewhale-owned xAI OAuth path has an invalid basename"
    );
    codewhale_config::with_xai_oauth_lifecycle_lock(|store| {
        get_owned_credentials_locked(store, name, refresh_access_token)
    })
}

fn get_owned_credentials_locked<F>(
    store: &codewhale_config::XaiOAuthCredentialStore,
    name: &str,
    refresh_access: F,
) -> Result<XaiOAuthCredentials>
where
    F: FnOnce(&str, &str, &str) -> Result<TokenResponse>,
{
    let path = store.path_for(name)?;
    let mut file = load_owned_auth_file_from_store(store, name)?.ok_or_else(|| {
        anyhow::anyhow!(
            "Codewhale-owned xAI OAuth credentials were not found at {}. Run `codewhale auth xai-device` again.",
            codewhale_config::quote_os_path(&path)
        )
    })?;
    let (scope, mut entry) = select_entry(&mut file).ok_or_else(|| {
        anyhow::anyhow!(
            "Codewhale-owned xAI OAuth credentials at {} have no usable entry. Run `codewhale auth xai-device` again.",
            codewhale_config::quote_os_path(&path)
        )
    })?;

    if entry_access_token_is_fresh(&entry) {
        let token = entry
            .key
            .clone()
            .filter(|t| !t.trim().is_empty())
            .context("xAI OAuth access token is empty")?;
        return Ok(credentials_from_entry(scope, &entry, token));

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Run `codewhale auth xai-device` again to perform a fresh device login and recreate the credential file.
  2. Check that the credential file at the quoted path was not deleted by cleanup jobs or manual intervention.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/tui/src/xai_oauth.rs:438 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/d43b46cbfff2995d. Report an issue: GitHub.