{"record":{"id":"c95381de866064e8","repo":"Hmbown/CodeWhale","slug":"codewhale-owned-xai-oauth-credentials-at-have-n","errorCode":null,"errorMessage":"Codewhale-owned xAI OAuth credentials at {} have no usable entry. Run `codewhale auth xai-device` again.","messagePattern":"Codewhale-owned xAI OAuth credentials at (.+?) have no usable entry\\. Run `codewhale auth xai-device` again\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/xai_oauth.rs","lineNumber":444,"sourceCode":"}\n\nfn get_owned_credentials_locked<F>(\n    store: &codewhale_config::XaiOAuthCredentialStore,\n    name: &str,\n    refresh_access: F,\n) -> Result<XaiOAuthCredentials>\nwhere\n    F: FnOnce(&str, &str, &str) -> Result<TokenResponse>,\n{\n    let path = store.path_for(name)?;\n    let mut file = load_owned_auth_file_from_store(store, name)?.ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Codewhale-owned xAI OAuth credentials were not found at {}. Run `codewhale auth xai-device` again.\",\n            codewhale_config::quote_os_path(&path)\n        )\n    })?;\n    let (scope, mut entry) = select_entry(&mut file).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Codewhale-owned xAI OAuth credentials at {} have no usable entry. Run `codewhale auth xai-device` again.\",\n            codewhale_config::quote_os_path(&path)\n        )\n    })?;\n\n    if entry_access_token_is_fresh(&entry) {\n        let token = entry\n            .key\n            .clone()\n            .filter(|t| !t.trim().is_empty())\n            .context(\"xAI OAuth access token is empty\")?;\n        return Ok(credentials_from_entry(scope, &entry, token));\n    }\n\n    let refresh = entry\n        .refresh_token\n        .as_deref()\n        .filter(|t| !t.trim().is_empty())","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/xai_oauth.rs#L426-L462","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/xai_oauth.rs:444 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `codewhale auth xai-device` again to obtain and store a fresh token entry.","If relying on grok-cli credentials instead, run `grok login` to refresh that store."],"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"}