Hmbown/CodeWhale · error · anyhow::Error

Codewhale-owned xAI OAuth credentials at {} have no usable e

Error message

Codewhale-owned xAI OAuth credentials at {} have no usable entry. Run `codewhale auth xai-device` again.

What it means

Raised in validate_external_credentials via get_owned_credentials_locked: the Codewhale-owned xAI OAuth credential file for the named account exists in the store but either the file is missing (earlier guard) or no entry in it yields a usable scope/credential pair. The stored credentials are stale or corrupt and cannot be refreshed; the user must re-run `codewhale auth xai-device` to re-provision them.

Source

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

}

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

    let refresh = entry
        .refresh_token
        .as_deref()
        .filter(|t| !t.trim().is_empty())

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Run `codewhale auth xai-device` again to obtain and store a fresh token entry.
  2. If relying on grok-cli credentials instead, run `grok login` to refresh that store.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/tui/src/xai_oauth.rs:444 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/c95381de866064e8. Report an issue: GitHub.