{"record":{"id":"7280aabc3bfd26f0","repo":"Hmbown/CodeWhale","slug":"no-local-api-key-was-found-in-config-the-secre","errorCode":null,"errorMessage":"No local {} API key was found in config, the secret store, or the environment","messagePattern":"No local (.+?) API key was found in config, the secret store, or the environment","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/cloud.rs","lineNumber":848,"sourceCode":"                        _ => \"not set\".to_string(),\n                    };\n                    writeln!(out, \"{}: {status} — {}\", row.id, row.display_label())?;\n                }\n                Ok(())\n            }\n            CloudKeysCommand::Set(set) => {\n                let provider = validate_provider_id(&set.provider)?;\n                let user = client.me()?;\n                let catalog = client.provider_catalog()?;\n                let row = catalog_row(&catalog, &provider)?;\n                let key = if set.from_local {\n                    let kind = row.local_kind().ok_or_else(|| {\n                        anyhow!(\n                            \"`{provider}` has no local runtime provider, so there is no local key to copy. Use `--api-key-stdin` or the hidden prompt\"\n                        )\n                    })?;\n                    resolve_local_key(config, provider_secrets, kind)?.ok_or_else(|| {\n                        anyhow!(\n                            \"No local {} API key was found in config, the secret store, or the environment\",\n                            kind.as_str()\n                        )\n                    })?\n                } else if set.api_key_stdin {\n                    key_reader(KeyReadMode::Stdin)?\n                } else {\n                    key_reader(KeyReadMode::HiddenPrompt(provider.clone()))?\n                };\n                let key = key.trim().to_string();\n                validate_api_key(&key)?;\n                let label = validate_label(&set.label)?;\n                client.set_key(&provider, &key, &label)?;\n                writeln!(\n                    out,\n                    \"Saved {provider} for Codewhale account {} (profile {}).\",\n                    printable(&user.id),\n                    printable(profile)","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/cloud.rs#L830-L866","documentation":"Thrown by the cloud `keys` set command after `local_kind()` succeeded but `resolve_local_key` returned None — meaning the provider has a local runtime kind, but no key for that kind was found in the config file, the secret store, or the environment. The error names all three lookup locations so the user knows where to put the key.","triggerScenarios":"Running `cloud keys set --from-local` where the provider's local kind exists but no matching API key is configured anywhere locally (config, OS secret store, env vars).","commonSituations":"Fresh machine without a configured key; key stored under a different provider/kind name than the catalog expects; env var not exported in the current shell; secret store locked or not initialized.","solutions":["Set the local API key first (config, secret store, or export the expected env var), then retry `--from-local`.","Or skip `--from-local` and provide the key directly with `--api-key-stdin` or the hidden prompt.","Verify the key is stored under the exact provider/kind the catalog's `local_kind()` reports (`kind.as_str()` in the message).","Check environment variable names and that the shell session actually has them exported."],"exampleFix":"// before\ncodewhale cloud keys set --provider openai --from-local   # no local key anywhere\n// after\nexport OPENAI_API_KEY=sk-...\ncodewhale cloud keys set --provider openai --from-local","handlingStrategy":"validation","validationCode":"// Ensure the local key exists before --from-local\nif std::env::var(\"OPENAI_API_KEY\").is_err() { eprintln!(\"local API key not found in config, secret store, or env\"); }","typeGuard":null,"tryCatchPattern":"match set_key_from_local(provider) {\n    Err(e) if e.to_string().contains(\"No local\") => {\n        // prompt for the key or use --api-key-stdin\n    }\n    other => other?,\n}","preventionTips":["Configure the local key (config, secret store, or env) before --from-local","Match the exact kind string the catalog reports","On fresh machines, run a key-availability check first"],"tags":["api-key","missing-credentials","cli"],"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"}