{"record":{"id":"50fa66555ee1b454","repo":"Hmbown/CodeWhale","slug":"codewhale-owned-oauth-credentials-were-not-found-at-run-hint","errorCode":null,"errorMessage":"Codewhale-owned OAuth credentials were not found at {}. Run `{hint}` again.","messagePattern":"Codewhale-owned OAuth credentials were not found at (.+?)\\. Run `(.+?)` again\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/oauth.rs","lineNumber":2237,"sourceCode":"                refresh,\n            )\n        })\n    })\n}\n\nfn get_owned_credentials_locked<F>(\n    provider: OAuthProvider,\n    store: &codewhale_config::XaiOAuthCredentialStore,\n    name: &str,\n    refresh_access: F,\n) -> Result<OwnedOAuthCredentials>\nwhere\n    F: FnOnce(&str, &str, &str) -> Result<OAuthTokenMaterial>,\n{\n    let hint = oauth_provider_params(provider).relogin_hint;\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 OAuth credentials were not found at {}. Run `{hint}` again.\",\n            codewhale_config::quote_os_path(&path)\n        )\n    })?;\n    let (scope, mut entry) = select_entry(provider, &mut file).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Codewhale-owned OAuth credentials at {} have no usable entry. Run `{hint}` again.\",\n            codewhale_config::quote_os_path(&path)\n        )\n    })?;\n\n    if entry_access_token_is_fresh(&entry) {\n        let token = entry\n            .access_token\n            .clone()\n            .filter(|t| !t.trim().is_empty())\n            .context(\"OAuth access token is empty\")?;\n        return Ok(credentials_from_entry(provider, &scope, &entry, token));","sourceCodeStart":2219,"sourceCodeEnd":2255,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/oauth.rs#L2219-L2255","documentation":"The locked owned-credential loader resolves the provider's file via store.path_for(name) and requires load_owned_auth_file_from_store to return Some(AuthFile). None means the file does not exist or holds nothing parseable, so no owned credentials are present; the error includes the path and the provider's relogin_hint command.","triggerScenarios":"The refresh closure path (issuer/client_id/refresh callback) attempts to load Codewhale-owned credentials when load_owned_auth_file_from_store returns None — file deleted, never created, or wiped by logout.","commonSituations":"Running with Codewhale-owned xAI storage after removing/never creating the credentials file; logout cleared storage but a cached session still tries to refresh; dotfile sync excluded the credentials directory.","solutions":["Run the provider's relogin command from the `{hint}` in the message (e.g. `codewhale auth xai-device`) to recreate the credentials.","Verify the quoted path exists; restore from backup if you have one.","If you intended to use external (Grok CLI) credentials instead, switch the auth_mode/import path accordingly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!fs.existsSync(store.path_for(name))) await relogin(provider);","typeGuard":null,"tryCatchPattern":"try { refreshOwned(provider); } catch (e) { if (String(e).includes('were not found at')) await relogin(provider); }","preventionTips":["Run the provider's login command before operations that refresh tokens","Don't delete credentials files manually; use the logout command and re-login","Ensure backup/sync tooling doesn't exclude the credentials directory"],"tags":["oauth","credentials","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}