{"record":{"id":"028f60de649763ac","repo":"Hmbown/CodeWhale","slug":"invalid-value-provider-for-provider-provid","errorCode":null,"errorMessage":"invalid value '{provider}' for '--provider <PROVIDER>': expected one of {expected}; configured custom providers are accepted only by exec and fleet","messagePattern":"invalid value '(.+?)' for '--provider <PROVIDER>': expected one of (.+?); configured custom providers are accepted only by exec and fleet","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":482,"sourceCode":"    command: Option<&Commands>,\n) -> Result<Option<ProviderKind>> {\n    let Some(provider) = provider else {\n        return Ok(None);\n    };\n    if let Some(provider) = builtin_provider_arg(provider) {\n        return Ok(Some(provider.into()));\n    }\n    if command_accepts_raw_provider(command) {\n        return Ok(None);\n    }\n\n    let expected = ProviderArg::value_variants()\n        .iter()\n        .filter_map(ValueEnum::to_possible_value)\n        .map(|value| value.get_name().to_string())\n        .collect::<Vec<_>>()\n        .join(\", \");\n    bail!(\n        \"invalid value '{provider}' for '--provider <PROVIDER>': expected one of {expected}; configured custom providers are accepted only by exec and fleet\"\n    )\n}\n\nfn prepare_raw_provider_tui_dispatch(\n    cli: &Cli,\n    command: Option<&Commands>,\n    runtime_overrides: &CliRuntimeOverrides,\n) -> Result<Option<(ResolvedRuntimeOptions, Vec<String>)>> {\n    let Some(provider) = cli.provider.as_deref() else {\n        return Ok(None);\n    };\n    if builtin_provider_arg(provider).is_some() || !command_accepts_raw_provider(command) {\n        return Ok(None);\n    }\n\n    let passthrough = match command {\n        Some(Commands::Exec(args)) => {","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/cli/src/lib.rs#L464-L500","documentation":"The global --provider flag accepts either a built-in provider kind (the ProviderArg enum: deepseek, nvidia-nim, openai, atlascloud, wanjie-ark, volcengine, openrouter, orcarouter, xiaomi-mimo, novita, fireworks, siliconflow, siliconflow-cn, arcee, moonshot, ...) or, only for the exec and fleet subcommands, an arbitrary configured custom provider id. Any other string on any other subcommand reaches this bail.","triggerScenarios":"Running e.g. `codewhale --provider my-custom chat` or `codewhale --provider Foo tui` (typo/case mismatch) where my-custom is a user-defined provider in config: only exec and fleet forward raw provider ids; every other command rejects them.","commonSituations":"Users who configured a custom provider (in providers config) and try to launch the TUI/chat with it; typos or wrong case in built-in names; aliases that only exist on the value enum (e.g. silicon-flow-cn) used elsewhere; scripts written for exec reused on other subcommands.","solutions":["Use the exec or fleet subcommand for custom provider ids: codewhale --provider my-custom exec \"...\"","Fix the spelling/case of a built-in name: --provider deepseek, --provider openrouter, --provider siliconflow-cn","List valid built-ins from the error message itself (it enumerates the expected values)","Set the custom provider as default or select it inside the TUI instead of via the global flag"],"exampleFix":"# before\ncodewhale --provider my-custom chat\n# after\ncodewhale --provider my-custom exec \"hello\"\n# or, for built-ins on any command:\ncodewhale --provider deepseek chat","handlingStrategy":"validation","validationCode":"fn accepts_custom_provider(command: &str) -> bool {\n    matches!(command, \"exec\" | \"fleet\")\n}\n\nlet builtin = [\"deepseek\",\"openai\",\"openrouter\",\"moonshot\",\"fireworks\",\"novita\",\n               \"siliconflow\",\"siliconflow-cn\",\"volcengine\",\"atlascloud\",\n               \"wanjie-ark\",\"nvidia-nim\",\"orcarouter\",\"xiaomi-mimo\",\"arcee\"];\nlet ok = builtin.contains(&provider) || accepts_custom_provider(subcommand);","typeGuard":"fn provider_ok_for_command(provider: &str, command: &str) -> bool {\n    const BUILTIN: &[&str] = &[\"deepseek\",\"openai\",\"openrouter\",\"moonshot\",\"fireworks\",\n        \"novita\",\"siliconflow\",\"siliconflow-cn\",\"volcengine\",\"atlascloud\",\n        \"wanjie-ark\",\"nvidia-nim\",\"orcarouter\",\"xiaomi-mimo\",\"arcee\"];\n    BUILTIN.contains(&provider) || matches!(command, \"exec\" | \"fleet\")\n}","tryCatchPattern":null,"preventionTips":["Route custom provider ids through exec/fleet only; document this in team scripts","Validate --provider against the built-in list before dispatch in wrappers","Derive the expected list from ProviderArg::value_variants() so it stays in sync"],"tags":["cli","provider","arguments","validation"],"backgroundTag":"invalid-cli-argument-value","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}