{"record":{"id":"881ac4ab330249b1","repo":"Hmbown/CodeWhale","slug":"invalid-runtime-set-value-must-not-be-empty","errorCode":null,"errorMessage":"invalid runtime --set: value must not be empty","messagePattern":"invalid runtime --set: value must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":1923,"sourceCode":"            \"model\" | \"default_text_model\" => values.model = Some(value.to_string()),\n            \"verbosity\" => values.verbosity = Some(value.to_string()),\n            \"approval_policy\" => values.approval_policy = Some(value.to_string()),\n            \"sandbox_mode\" => values.sandbox_mode = Some(value.to_string()),\n            \"telemetry\" => {\n                let mut config = ConfigToml::default();\n                config\n                    .set_value(\"telemetry\", value)\n                    .map_err(|_| anyhow!(\"invalid --set telemetry: expected a boolean\"))?;\n                values.telemetry = config.telemetry;\n            }\n            _ => bail!(\n                \"unsupported runtime --set key (value omitted): supported keys are provider, \\\n                 model, default_text_model, verbosity, approval_policy, sandbox_mode and \\\n                 telemetry; use the dedicated option or config set for other keys\"\n            ),\n        }\n        if value.trim().is_empty() {\n            bail!(\"invalid runtime --set: value must not be empty\");\n        }\n    }\n    // A dedicated flag is more specific than a generic --set for the same\n    // field. Repeated --set keys otherwise keep their last value.\n    cli.provider = cli.provider.take().or(provider);\n    cli.model = cli.model.take().or(values.model);\n    cli.verbosity = cli.verbosity.take().or(values.verbosity);\n    cli.approval_policy = cli.approval_policy.take().or(values.approval_policy);\n    cli.sandbox_mode = cli.sandbox_mode.take().or(values.sandbox_mode);\n    cli.telemetry = cli.telemetry.or(values.telemetry);\n    Ok(())\n}\n\nfn run() -> Result<()> {\n    let matches = Cli::command().get_matches();\n    let project_bundle_scope = config_command_targets_project(&matches);\n    let mut cli = Cli::from_arg_matches(&matches).unwrap_or_else(|error| error.exit());\n","sourceCodeStart":1905,"sourceCodeEnd":1941,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L1905-L1941","documentation":"After a supported `--set` key is matched, `apply_runtime_set_overrides` validates that the value is non-empty (`value.trim().is_empty()`). Empty values are rejected because an empty string would be written into the config/runtime override and silently disable or corrupt the setting. This typically results from `--set key=` with nothing after the equals sign or an unexpanded shell variable.","triggerScenarios":"Passing `--set model=`, `--set provider=\"$PROVIDER\"` where `$PROVIDER` is unset/empty, or any `--set key=<whitespace>`.","commonSituations":"Unset environment variables in shell scripts (`--set model=\"$MODEL\"`), copy-paste dropping the value, templating tools substituting an empty string, or hand-edited command lines.","solutions":["Supply a concrete value after the `=`: `--set model=gpt-x`.","If using a shell variable, check it is set before invoking: `${MODEL:?MODEL is not set}` or a guard in the script.","Remove the `--set` flag entirely if you meant to keep the configured default."],"exampleFix":"// before (shell)\ncodewhale --set model=\"$MODEL\" exec \"hi\"   # MODEL unset\n// error: invalid runtime --set: value must not be empty\n\n// after\ncodewhale --set model=\"${MODEL:?MODEL is not set}\" exec \"hi\"","handlingStrategy":"validation","validationCode":"# shell guard before invoking\n: \"${MODEL:?MODEL must be set}\"\ncodewhale --set model=\"$MODEL\" exec \"hi\"","typeGuard":null,"tryCatchPattern":"match run(args) {\n    Err(e) if e.to_string().contains(\"value must not be empty\") => {\n        eprintln!(\"--set value was empty; check the source variable\");\n    }\n    r => r?,\n}","preventionTips":["Never interpolate unset shell variables into --set; use ${VAR:?msg}.","Trim-check values in wrapper scripts before building the command.","Quote all --set values to catch accidental empty substitutions."],"tags":["cli","configuration","validation","shell"],"backgroundTag":"empty-required-field","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}