{"record":{"id":"b5de256563de85bd","repo":"Hmbown/CodeWhale","slug":"codewhale-api-key-not-found-so-no-request-was-sent-the","errorCode":null,"errorMessage":"Codewhale API key not found, so no request was sent.\n\nThe Codewhale API authenticates every model with one account API key carrying the `models:infer` scope.\n\n1. Create one and save it on this machine:\n       codewhale account api-keys create --name <name> --scope models:infer --use\n2. Or export it for this shell:\n       export CODEWHALE_API_KEY=cwc_key_...\n\nYou can also create a key at {} and put it in [providers.codewhale] api_key (or api_key_env).","messagePattern":"Codewhale API key not found, so no request was sent\\.\n\nThe Codewhale API authenticates every model with one account API key carrying the `models:infer` scope\\.\n\n1\\. Create one and save it on this machine:\n       codewhale account api-keys create --name <name> --scope models:infer --use\n2\\. Or export it for this shell:\n       export CODEWHALE_API_KEY=cwc_key_\\.\\.\\.\n\nYou can also create a key at (.+?) and put it in \\[providers\\.codewhale\\] api_key \\(or api_key_env\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":7320,"sourceCode":"            && (provider_route_is_keyless_self_hosted(provider, &self.active_route_base_url())\n                || base_url_uses_local_host(&self.active_route_base_url()))\n        {\n            return Ok(String::new());\n        }\n\n        if custom_endpoint {\n            let route_name = self\n                .provider\n                .as_deref()\n                .unwrap_or_else(|| provider.as_str());\n            anyhow::bail!(\n                \"Custom endpoint credentials for {route_name} must be bound explicitly. Ambient provider credentials are not sent to {}. Add api_key or api_key_env to this provider route, or pass --api-key with --base-url.\",\n                self.active_route_base_url()\n            );\n        }\n\n        match provider {\n            ApiProvider::Codewhale => anyhow::bail!(\n                \"Codewhale API key not found, so no request was sent.\\n\\\n                 \\n\\\n                 The Codewhale API authenticates every model with one account \\\n                 API key carrying the `models:infer` scope.\\n\\\n                 \\n\\\n                 1. Create one and save it on this machine:\\n\\\n                        codewhale account api-keys create --name <name> --scope models:infer --use\\n\\\n                 2. Or export it for this shell:\\n\\\n                        export CODEWHALE_API_KEY=cwc_key_...\\n\\\n                 \\n\\\n                 You can also create a key at {} and put it in \\\n                 [providers.codewhale] api_key (or api_key_env).\",\n                provider\n                    .credential_url()\n                    .unwrap_or(\"https://app.codewhale.net/settings?section=api\")\n            ),\n            ApiProvider::Deepseek | ApiProvider::DeepseekCN => anyhow::bail!(\n                \"DeepSeek API key not found.\\n\\","sourceCodeStart":7302,"sourceCodeEnd":7338,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L7302-L7338","documentation":"The Codewhale provider requires one account-level API key with the models:infer scope to authenticate every model request. When no key can be found via override, env var, config, or the secret store, the library bails before sending anything, with instructions to create and register a key.","triggerScenarios":"Provider resolves to ApiProvider::Codewhale and CODEWHALE_API_KEY is unset, no [providers.codewhale] api_key/api_key_env exists, and no key is stored via 'codewhale account api-keys create --use' or 'codewhale auth set'.","commonSituations":"Fresh install without onboarding; a new shell/CI environment where CODEWHALE_API_KEY was never exported; switching machines without migrating the stored key.","solutions":["Run: codewhale account api-keys create --name <name> --scope models:infer --use","Or export CODEWHALE_API_KEY=cwc_key_... for the current shell/CI job.","Or create a key at the app.codewhale.net settings URL and put api_key (or api_key_env) under [providers.codewhale] in ~/.codewhale/config.toml."],"exampleFix":"// before\n# no codewhale credentials configured\n\n// after\nexport CODEWHALE_API_KEY=cwc_key_...\n# or in ~/.codewhale/config.toml:\n# [providers.codewhale]\n# api_key = \"cwc_key_...\"","handlingStrategy":"validation","validationCode":"std::env::var(\"CODEWHALE_API_KEY\")\n    .ok()\n    .filter(|k| k.starts_with(\"cwc_key_\") && !k.trim().is_empty())\n    .ok_or_else(|| \"CODEWHALE_API_KEY missing; run codewhale account api-keys create --scope models:infer --use\".to_string())?;","typeGuard":"fn codewhale_key_ready(env_val: Option<&str>) -> bool {\n    env_val.map(|k| k.starts_with(\"cwc_key_\") && k.len() > 10).unwrap_or(false)\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"Codewhale API key not found\") => {\n        eprintln!(\"run: codewhale account api-keys create --name ci --scope models:infer --use\");\n    }\n    other => other?,\n}","preventionTips":["Run the create --use command once during onboarding so a durable key exists.","In CI, always export CODEWHALE_API_KEY as a secret before launching codewhale.","Prefer ~/.zshenv (not ~/.zshrc) for exports so non-interactive shells see them."],"tags":["auth","api-key","codewhale","setup"],"backgroundTag":"missing-api-key","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"}