{"record":{"id":"836bd139d49714f9","repo":"Hmbown/CodeWhale","slug":"unrecognized-provider-provider-arg-known-pr","errorCode":null,"errorMessage":"Unrecognized --provider {provider_arg:?}. Known providers: {} or a configured [providers.<name>] custom provider","messagePattern":"Unrecognized --provider (.+?)\\. Known providers: (.+?) or a configured \\[providers\\.<name>\\] custom provider","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":861,"sourceCode":"fn apply_exec_provider_override(config: &mut Config, provider_arg: &str) -> Result<()> {\n    let provider_arg = provider_arg.trim();\n    if provider_arg.is_empty() {\n        return Ok(());\n    }\n    if config\n        .providers\n        .as_ref()\n        .and_then(|providers| providers.custom_provider_config(provider_arg))\n        .is_some()\n    {\n        config.provider = Some(provider_arg.to_string());\n        return Ok(());\n    }\n    if let Some(provider) = crate::config::ApiProvider::parse(provider_arg) {\n        config.provider = Some(provider.as_str().to_string());\n        return Ok(());\n    }\n    bail!(\n        \"Unrecognized --provider {provider_arg:?}. Known providers: {} \\\n         or a configured [providers.<name>] custom provider\",\n        crate::config::ApiProvider::names_hint()\n    );\n}\n\nfn exec_model_env_override() -> Option<String> {\n    let read = || {\n        [\"CODEWHALE_MODEL\", \"DEEPSEEK_MODEL\"]\n            .into_iter()\n            .find_map(|key| {\n                std::env::var(key)\n                    .ok()\n                    .map(|model| model.trim().to_string())\n                    .filter(|model| !model.is_empty())\n            })\n    };\n    #[cfg(test)]","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L843-L879","documentation":"`--provider` must resolve to either a built-in ApiProvider id (parsed case-insensitively, e.g. deepseek, deepseek-cn, zai, moonshot, openrouter, xai, together, ...) or the name of a custom provider declared in a `[providers.<name>]` table in the loaded config (checked via custom_provider_config). If both lookups miss, the CLI bails and prints the built-in names this build knows.","triggerScenarios":"Passing a typo'd or unsupported id (`--provider gpt4`, `--provider open_ai`, `--provider Open AI`); naming a custom provider whose `[providers.<name>]` table is absent from the config file actually loaded (for example when --config points elsewhere); using an id renamed or removed in a newer release.","commonSituations":"Scripting `codewhale exec --provider` from memory instead of the hint list; adding a local LM Studio/Ollama-compatible endpoint but forgetting the [providers.<name>] table; config drift between machines; legacy aliases like deepseek-china that only ApiProvider::parse accepts.","solutions":["Re-run and read the printed known-provider list; use the exact id with correct dashes/underscores","For a custom endpoint, add a `[providers.<name>]` table (kind + base_url) to the config and pass that name","Verify which config file is in effect (--config flag, profile) and that the table is inside it","Check case-insensitive spelling: deepseek-cn, deepseek_china, deepseekcn, deepseek-china all parse"],"exampleFix":"# before\ncodewhale exec --provider open_ai \"hi\"          # Unrecognized --provider \"open_ai\"\n\n# after (built-in)\ncodewhale exec --provider openai \"hi\"\n\n# after (custom, in codewhale config)\n[providers.lm-studio]\nkind = \"openai-compatible\"\nbase_url = \"http://127.0.0.1:1234/v1\"\n# then: codewhale exec --provider lm-studio \"hi\"","handlingStrategy":"validation","validationCode":"# Fail fast on unknown provider ids before launching\nPROVIDER=\"$1\"\ncodewhale exec --provider \"$PROVIDER\" --help >/dev/null 2>&1 || true\n# authoritative check: known built-ins or a [providers.<name>] table in config\ngrep -q \"^\\[providers\\.$PROVIDER\\]\" \"$(codewhale config path 2>/dev/null || echo config.toml)\" \\\n  || codewhale --help | grep -q \"\\b$PROVIDER\\b\" \\\n  || { echo \"unknown provider: $PROVIDER\"; exit 2; }","typeGuard":null,"tryCatchPattern":"capture stderr; if it matches /Unrecognized --provider/, print the known list from the message and fail fast instead of retrying with the same id","preventionTips":["Source provider ids from the error's own hint list, never from memory","Define custom endpoints as [providers.<name>] tables before referencing them","Assert the provider name in CI before long exec runs"],"tags":["provider","cli","config","validation"],"backgroundTag":"unknown-provider","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}