Hmbown/CodeWhale · error · anyhow::Error

xAI OAuth credentials at {} have no usable entry. Run `grok

Error message

xAI OAuth credentials at {} have no usable entry. Run `grok login` again or use `codewhale auth xai-device` for Codewhale-owned storage.

What it means

Credential lookup guard in get_credentials: neither the Codewhale-owned xAI auth file nor any granted external (grok-cli) credential file contains a usable token entry. Both sources were checked and produced no valid entry.

Source

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

        "Codewhale-owned xAI OAuth credentials are inactive until the xAI route explicitly selects OAuth"
    );
    if let Some(owned_path) = configured_owned_auth_file_path(config)? {
        return get_owned_credentials(&owned_path);
    }
    let owned_path = codewhale_auth_file_path()?;
    if load_owned_auth_file(&owned_path)?.is_some() {
        return get_owned_credentials(&owned_path);
    }

    let external_path = auth_file_path();
    let grant = config.external_credential_read_grant(
        ApiProvider::Xai,
        codewhale_config::ExternalCredentialSource::GrokCli,
        &external_path,
    )?;
    let mut file = load_external_auth_file(&grant)?;
    let (scope, entry) = select_entry(&mut file).ok_or_else(|| {
        anyhow::anyhow!(
            "xAI OAuth credentials at {} have no usable entry. Run `grok login` again or use `codewhale auth xai-device` for Codewhale-owned storage.",
            codewhale_config::quote_os_path(grant.path())
        )
    })?;
    if !entry_access_token_is_fresh(&entry) {
        bail!(
            "xAI OAuth access token in {} is expired. Read-only consent never refreshes or rewrites another CLI's credentials. Run `grok login` again or use `codewhale auth xai-device`.",
            codewhale_config::quote_os_path(grant.path())
        );
    }
    let token = entry
        .key
        .clone()
        .filter(|token| !token.trim().is_empty())
        .context("xAI OAuth access token is empty")?;
    Ok(credentials_from_entry(scope, &entry, token))
}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Run `grok login` to re-authenticate the external grok-cli credential store.
  2. Run `codewhale auth xai-device` to create Codewhale-owned xAI OAuth credentials directly.
  3. Verify the configured external credential read grant points at the correct grok-cli auth file path.
Defensive patterns

Strategy: retry

When it happens

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