{"record":{"id":"279e5c814d90d392","repo":"Hmbown/CodeWhale","slug":"invalid-approval-policy-policy-expected-on-re","errorCode":null,"errorMessage":"Invalid approval_policy '{policy}': expected on-request, untrusted, never, auto, or suggest.","messagePattern":"Invalid approval_policy '(.+?)': expected on-request, untrusted, never, auto, or suggest\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":5166,"sourceCode":"            let provider = self.api_provider();\n            let known = model_completion_names_for_provider(provider);\n            let hint = if known.is_empty() {\n                String::new()\n            } else {\n                format!(\" (for example: {})\", known.join(\", \"))\n            };\n            anyhow::bail!(\n                \"Invalid configured model '{model}' for provider '{}': expected auto or a model ID this provider serves{hint}.\",\n                provider.as_str()\n            );\n        }\n        if let Some(policy) = self.approval_policy.as_deref() {\n            let normalized = policy.trim().to_ascii_lowercase();\n            if !matches!(\n                normalized.as_str(),\n                \"on-request\" | \"untrusted\" | \"never\" | \"auto\" | \"suggest\"\n            ) {\n                anyhow::bail!(\n                    \"Invalid approval_policy '{policy}': expected on-request, untrusted, never, auto, or suggest.\"\n                );\n            }\n        }\n        if let Some(v) = self.verbosity.as_deref() {\n            let normalized = v.trim().to_ascii_lowercase();\n            if !matches!(normalized.as_str(), \"normal\" | \"concise\") {\n                anyhow::bail!(\"Invalid verbosity '{v}': expected normal or concise.\");\n            }\n        }\n        if let Some(mode) = self.sandbox_mode.as_deref() {\n            let normalized = mode.trim().to_ascii_lowercase();\n            if !matches!(\n                normalized.as_str(),\n                \"read-only\" | \"workspace-write\" | \"danger-full-access\" | \"external-sandbox\"\n            ) {\n                anyhow::bail!(\n                    \"Invalid sandbox_mode '{mode}': expected read-only, workspace-write, danger-full-access, or external-sandbox.\"","sourceCodeStart":5148,"sourceCodeEnd":5184,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L5148-L5184","documentation":"The `approval_policy` config field is a closed enum: after trimming and lowercasing it must be one of `on-request`, `untrusted`, `never`, `auto`, or `suggest`. Any other string fails config validation.","triggerScenarios":"`Config::validate` encounters an `approval_policy` whose trimmed, ASCII-lowercased value does not match the five accepted literals.","commonSituations":"Typo like `on_request` (underscore) or `OnRequest` copied with casing conventions from another tool; translating an approval mode from a different CLI whose names differ; hand-editing the config.","solutions":["Set `approval_policy` to one of: on-request, untrusted, never, auto, suggest.","Fix casing/spacing — the validator lowercases and trims, so `ON-REQUEST` is fine but `on request` is not.","Remove the `approval_policy` key entirely if you want the default."],"exampleFix":"// before (config.toml)\napproval_policy = \"on_request\"\n\n// after\napproval_policy = \"on-request\"","handlingStrategy":"validation","validationCode":"const APPROVAL_POLICIES: [&str; 5] = [\"on-request\", \"untrusted\", \"never\", \"auto\", \"suggest\"];\nlet normalized = policy.trim().to_ascii_lowercase();\nassert!(APPROVAL_POLICIES.contains(&normalized.as_str()), \"bad approval_policy: {policy}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the CLI/config UI to set approval_policy rather than hand-editing.","Remember the value is hyphenated: `on-request`, not `on_request`.","Omit the key to accept the default instead of guessing a value."],"tags":["config","validation","enum"],"backgroundTag":"invalid-enum-value","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"}