{"record":{"id":"e93ff2bd6056d35a","repo":"Hmbown/CodeWhale","slug":"external-xai-grok-credential-file-not-found-at","errorCode":null,"errorMessage":"external xAI/Grok credential file not found at {}","messagePattern":"external xAI/Grok credential file not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/xai_oauth.rs","lineNumber":814,"sourceCode":"    };\n    parse_auth_file(&raw, path).map(Some)\n}\n\nfn load_owned_auth_file_from_store(\n    store: &codewhale_config::XaiOAuthCredentialStore,\n    name: &str,\n) -> Result<Option<AuthFile>> {\n    let Some(raw) = store.read_to_string(name)? else {\n        return Ok(None);\n    };\n    parse_auth_file(&raw, &store.path_for(name)?).map(Some)\n}\n\nfn load_external_auth_file(\n    grant: &codewhale_config::ExternalCredentialReadGrant,\n) -> Result<AuthFile> {\n    let Some(raw) = crate::external_credentials::read_to_string(grant)? else {\n        bail!(\n            \"external xAI/Grok credential file not found at {}\",\n            codewhale_config::quote_os_path(grant.path())\n        );\n    };\n    parse_auth_file(&raw, grant.path())\n}\n\nfn parse_auth_file(raw: &str, path: &Path) -> Result<AuthFile> {\n    let value: Value = serde_json::from_str(raw).map_err(|_| {\n        anyhow::anyhow!(\n            \"xAI/Grok credential file {} is not valid credential JSON\",\n            codewhale_config::quote_os_path(path)\n        )\n    })?;\n    let obj = value.as_object().ok_or_else(|| {\n        anyhow::anyhow!(\n            \"xAI/Grok credential file {} must be a JSON object of entries\",\n            codewhale_config::quote_os_path(path)","sourceCodeStart":796,"sourceCodeEnd":832,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/xai_oauth.rs#L796-L832","documentation":"Raised in load_external_auth_file when the external Grok CLI credential file granted for reading does not exist at the expected path (typically ~/.grok/... referenced by the read grant). This sentinel guard fires when external credential borrowing is enabled but the source CLI has never logged in on this machine.","triggerScenarios":"Thrown at crates/tui/src/xai_oauth.rs:814 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `grok login` to create the external credential file","Use `codewhale auth xai-device` to create owned credentials instead of borrowing","Check the path in the error message and the external credential read grant configuration"],"exampleFix":null,"handlingStrategy":"fallback","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-14T05:17:10.506Z"}