{"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":537,"sourceCode":"fn top_level_provider_override(\n    provider: Option<&str>,\n    command: Option<&Commands>,\n) -> Result<Option<ProviderKind>> {\n    let Some(provider) = provider else {\n        return Ok(None);\n    };\n    if is_antigravity_legacy_selector(provider) {\n        bail!(codewhale_config::LEGACY_ANTIGRAVITY_TOMBSTONE_MESSAGE);\n    }\n    if let Some(provider) = builtin_provider_arg(provider) {\n        return Ok(Some(provider));\n    }\n    if command_accepts_raw_provider(command) {\n        return Ok(None);\n    }\n\n    let expected = ProviderKind::names_hint();\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":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L519-L555","documentation":"`top_level_provider_override` fails when `--provider` receives a value that is neither a builtin `ProviderKind` nor a legacy antigravity selector, on a command that does not accept raw provider ids. Raw/custom provider ids are restricted to the `exec` and `fleet` subcommands, so everywhere else only builtin provider names are legal.","triggerScenarios":"`codewhale --provider my-custom-provider ...` on any command where `command_accepts_raw_provider` is false; misspelling a builtin name (e.g. `--provider antropic`); using a custom provider id configured in config files at the top level instead of via exec/fleet.","commonSituations":"Typo'd provider names; users assuming their configured custom providers work everywhere; old scripts using a custom id at top level after the exec/fleet-only restriction was introduced.","solutions":["Use a builtin provider name listed in the error's `expected one of {expected}` hint.","Move the custom provider usage to the `exec` or `fleet` subcommand, which are the only commands accepting raw provider ids.","Fix the spelling of the provider name in the command line or script."],"exampleFix":"// before\ncodewhale --provider my-custom \"do work\"\n// after\ncodewhale exec --provider my-custom \"do work\"","handlingStrategy":"validation","validationCode":"const BUILTIN = new Set(['openai','anthropic']); // see ProviderKind::names_hint()\nconst RAW_OK = ['exec','fleet'];\nif (!BUILTIN.has(provider) && !RAW_OK.includes(subcommand)) throw new Error(`custom provider '${provider}' only allowed via exec/fleet`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate `--provider` against the hint list before invoking.","Route custom providers exclusively through exec/fleet subcommands."],"tags":["cli","provider","argument-validation"],"backgroundTag":"invalid-cli-argument","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"}