{"record":{"id":"45cc3a2f4faeb742","repo":"Hmbown/CodeWhale","slug":"xai-oauth-credentials-at-have-no-usable-entry","errorCode":null,"errorMessage":"xAI OAuth credentials at {} have no usable entry. Run `grok login` again or use `codewhale auth xai-device` for Codewhale-owned storage.","messagePattern":"xAI OAuth credentials at (.+?) have no usable entry\\. Run `grok login` again or use `codewhale auth xai-device` for Codewhale-owned storage\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/xai_oauth.rs","lineNumber":389,"sourceCode":"        \"Codewhale-owned xAI OAuth credentials are inactive until the xAI route explicitly selects OAuth\"\n    );\n    if let Some(owned_path) = configured_owned_auth_file_path(config)? {\n        return get_owned_credentials(&owned_path);\n    }\n    let owned_path = codewhale_auth_file_path()?;\n    if load_owned_auth_file(&owned_path)?.is_some() {\n        return get_owned_credentials(&owned_path);\n    }\n\n    let external_path = auth_file_path();\n    let grant = config.external_credential_read_grant(\n        ApiProvider::Xai,\n        codewhale_config::ExternalCredentialSource::GrokCli,\n        &external_path,\n    )?;\n    let mut file = load_external_auth_file(&grant)?;\n    let (scope, entry) = select_entry(&mut file).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"xAI OAuth credentials at {} have no usable entry. Run `grok login` again or use `codewhale auth xai-device` for Codewhale-owned storage.\",\n            codewhale_config::quote_os_path(grant.path())\n        )\n    })?;\n    if !entry_access_token_is_fresh(&entry) {\n        bail!(\n            \"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`.\",\n            codewhale_config::quote_os_path(grant.path())\n        );\n    }\n    let token = entry\n        .key\n        .clone()\n        .filter(|token| !token.trim().is_empty())\n        .context(\"xAI OAuth access token is empty\")?;\n    Ok(credentials_from_entry(scope, &entry, token))\n}\n","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/xai_oauth.rs#L371-L407","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/xai_oauth.rs:389 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `grok login` to re-authenticate the external grok-cli credential store.","Run `codewhale auth xai-device` to create Codewhale-owned xAI OAuth credentials directly.","Verify the configured external credential read grant points at the correct grok-cli auth file path."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}