{"record":{"id":"512bf10ba464dd17","repo":"Hmbown/CodeWhale","slug":"codewhale-owned-oauth-credentials-are-not-configured","errorCode":null,"errorMessage":"Codewhale-owned {} OAuth credentials are not configured","messagePattern":"Codewhale-owned (.+?) OAuth credentials are not configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/oauth.rs","lineNumber":2182,"sourceCode":"    Ok(get_xai_credentials(config)?.access_token)\n}\n\n/// Load ChatGPT owned credentials from the configured generation,\n/// refreshing through the seam when stale.\npub fn get_owned_credentials(\n    provider: OAuthProvider,\n    config: &Config,\n) -> Result<OwnedOAuthCredentials> {\n    get_owned_credentials_with(provider, config, &ReqwestOAuthFormClient)\n}\n\nfn get_owned_credentials_with(\n    provider: OAuthProvider,\n    config: &Config,\n    client: &dyn OAuthFormClient,\n) -> Result<OwnedOAuthCredentials> {\n    let Some(path) = configured_owned_auth_file_path(provider, config)? else {\n        bail!(\n            \"Codewhale-owned {} OAuth credentials are not configured\",\n            oauth_provider_params(provider).display_name\n        );\n    };\n    let name = path\n        .file_name()\n        .and_then(|name| name.to_str())\n        .context(\"Codewhale-owned OAuth path must have a UTF-8 basename\")?;\n    codewhale_config::with_xai_oauth_lifecycle_lock(|store| {\n        get_owned_credentials_locked(provider, store, name, |issuer, client_id, refresh| {\n            refresh_for_provider(provider, client, issuer, client_id, refresh)\n        })\n    })\n}\n\nfn get_owned_credentials_at(provider: OAuthProvider, path: &Path) -> Result<OwnedOAuthCredentials> {\n    let directory = codewhale_config::xai_oauth_credentials_dir()?;\n    anyhow::ensure!(","sourceCodeStart":2164,"sourceCodeEnd":2200,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/oauth.rs#L2164-L2200","documentation":"`get_owned_credentials_with` looks up the configured auth-file path for Codewhale-owned credentials of the given provider; when `configured_owned_auth_file_path` returns `None`, no owned credential storage is configured and it fails with the provider's display name. This only concerns Codewhale's own credential files, not imported external ones.","triggerScenarios":"Calling `get_owned_credentials_with(provider, config, client)` when the config lacks the owned auth-file path for that provider — `configured_owned_auth_file_path(provider, config)` yields `None`.","commonSituations":"Fresh install where the user never ran the provider's device login; config file missing the owned-credentials path setting; wrong config profile loaded that doesn't define the provider's storage.","solutions":["Run the provider's Codewhale-owned login (e.g. `codewhale auth xai-device`) to create/configure owned credentials.","Check the config for the owned auth-file path setting for this provider and set it if absent.","Verify you loaded the intended config profile/environment."],"exampleFix":"// before\n# config has no owned xAI auth path; codewhale reads owned creds -> bail\n// after\n$ codewhale auth xai-device   # configures Codewhale-owned xAI storage","handlingStrategy":"validation","validationCode":"let configured = configured_owned_auth_file_path(provider, config);\nif configured.is_none() {\n    // run the provider's owned login (e.g. codewhale auth xai-device) first\n}","typeGuard":"fn owned_credentials_configured(provider: OAuthProvider, config: &Config) -> bool {\n    configured_owned_auth_file_path(provider, config).is_some()\n}","tryCatchPattern":null,"preventionTips":["Complete the owned-device login once before commands that read owned credentials.","Ensure the active config profile defines the owned auth-file path for the provider.","Don't mix profiles: verify which config file is loaded."],"tags":["oauth","config","missing-credentials"],"backgroundTag":"missing-credentials","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"}