{"record":{"id":"07ff83a45e8007ec","repo":"Hmbown/CodeWhale","slug":"failed-to-update-setting-invalid-sandbox-mode-v","errorCode":null,"errorMessage":"Failed to update setting: invalid sandbox_mode '{value}'. Expected: read-only, workspace-write, danger-full-access, or external-sandbox.","messagePattern":"Failed to update setting: invalid sandbox_mode '(.+?)'\\. Expected: read-only, workspace-write, danger-full-access, or external-sandbox\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/settings.rs","lineNumber":1715,"sourceCode":"                anyhow::bail!(\n                    \"Model defaults belong to config.toml. Use /model and choose Remember as my default, or /config model <id> --save.\"\n                );\n            }\n            \"reasoning_effort\" | \"effort\" => {\n                self.reasoning_effort = normalize_reasoning_effort_setting(value)?;\n            }\n            \"permission_posture\" | \"permissions\" => {\n                self.permission_posture = normalize_permission_posture(value);\n                if self.permission_posture.is_none() {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid permission posture '{value}'. Expected: ask, auto-review, or full-access.\"\n                    );\n                }\n            }\n            \"sandbox_mode\" | \"sandbox\" | \"filesystem_sandbox\" => {\n                self.sandbox_mode = normalize_sandbox_mode(value);\n                if self.sandbox_mode.is_none() {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid sandbox_mode '{value}'. Expected: read-only, workspace-write, danger-full-access, or external-sandbox.\"\n                    );\n                }\n            }\n            _ => {\n                anyhow::bail!(\"Failed to update setting: unknown setting '{key}'.\");\n            }\n        }\n        if let Some(canonical) = canonical {\n            self.provenance\n                .insert(canonical.to_string(), Layer::SessionOverride);\n        }\n        Ok(())\n    }\n\n    /// Apply a named settings preset (#3478).\n    ///\n    /// Presets are the first bundled-settings mechanism: a single name applies a","sourceCodeStart":1697,"sourceCodeEnd":1733,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/settings.rs#L1697-L1733","documentation":"The sandbox_mode setting (aliases `sandbox`, `filesystem_sandbox`) must normalize to one of read-only, workspace-write, danger-full-access, or external-sandbox; otherwise normalize_sandbox_mode returns None and the arm bails. This mirrors the Codex-style sandbox vocabulary and gates filesystem access, so unknown values are rejected.","triggerScenarios":"Calling Settings::set(\"sandbox_mode\", v) (or aliases) or /config sandbox <v> with values like 'none', 'strict', 'workspace', or underscore forms such as 'workspace_write'.","commonSituations":"Configs copied from Codex/other tools using 'danger-full-access' variants with different spelling; users writing 'read_only' with an underscore; assuming 'off' disables sandboxing.","solutions":["Use one of: read-only, workspace-write, danger-full-access, external-sandbox (check normalize_sandbox_mode for aliases).","Match the hyphenated spelling exactly; underscores are not accepted unless the normalizer maps them.","Choose the least privileged mode that works (read-only or workspace-write) instead of danger-full-access."],"exampleFix":"// before\nsettings.set(\"sandbox\", \"workspace_write\")?;\n// after\nsettings.set(\"sandbox\", \"workspace-write\")?;","handlingStrategy":"validation","validationCode":"const SANDBOX_MODES: [&str; 4] = [\"read-only\", \"workspace-write\", \"danger-full-access\", \"external-sandbox\"];\nif !SANDBOX_MODES.contains(&value.trim().to_ascii_lowercase().as_str()) {\n    return Err(format!(\"sandbox_mode must be one of {SANDBOX_MODES:?}\"));\n}\nsettings.set(\"sandbox_mode\", value)?;","typeGuard":"fn is_valid_sandbox(v: &str) -> bool {\n    matches!(v.trim().to_ascii_lowercase().as_str(),\n        \"read-only\" | \"workspace-write\" | \"danger-full-access\" | \"external-sandbox\")\n}","tryCatchPattern":"match settings.set(\"sandbox\", value) {\n    Ok(()) => {}\n    Err(e) if e.to_string().contains(\"invalid sandbox_mode\") => {\n        eprintln!(\"{e}; using 'workspace-write'\");\n        settings.set(\"sandbox\", \"workspace-write\")?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use hyphens, not underscores, in mode names.","Pick the least privileged mode that works.","Keep the Codex-compatible vocabulary when porting configs."],"tags":["settings","sandbox","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}