Hmbown/CodeWhale · error
Invalid sandbox_mode
Error message
Invalid sandbox_mode '{mode}': expected read-only, workspace-write, danger-full-access, or external-sandbox. What it means
The `sandbox_mode` config field must be one of `read-only`, `workspace-write`, `danger-full-access`, or `external-sandbox` after trimming and lowercasing. The validator rejects any other value to keep sandbox posture deterministic at load time.
Solutions
- Set `sandbox_mode` to one of: read-only, workspace-write, danger-full-access, external-sandbox.
- Fix underscore vs hyphen: the validator lowercases but does not normalize separators.
- Remove the key to fall back to the default sandbox mode.
Example fix
// before (config.toml) sandbox_mode = "danger_full_access" // after sandbox_mode = "danger-full-access"
Defensive patterns
Strategy: validation
Validate before calling
const SANDBOX_MODES: [&str; 4] = ["read-only", "workspace-write", "danger-full-access", "external-sandbox"];
assert!(SANDBOX_MODES.contains(&sandbox_mode.trim().to_ascii_lowercase().as_str()), "bad sandbox_mode: {sandbox_mode}"); Prevention
- Use hyphens, not underscores, in sandbox mode names.
- Omit the key to use the default sandbox posture.
- Never set danger-full-access casually; prefer read-only or workspace-write.
When it happens
Trigger: `Config::validate` encounters a `sandbox_mode` value that does not match the four accepted literals.
Common situations: Copying a sandbox mode name from Codex or another agent CLI (e.g. `workspace-write-docker`); typos like `danger_full_access`; inventing modes such as `none` or `off`.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- sandbox_mode ' ' is not allowed by requirements ( )
- Unsupported sandbox_backend setting. Choose opensandbox, or…
- agent profile provider cannot be empty
- agent profile provider must be a simple provider id
- api_key cannot be empty string
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/2ba669a2777f00a0.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/config.rs:5183
) {
anyhow::bail!(
"Invalid approval_policy '{policy}': expected on-request, untrusted, never, auto, or suggest."
);
}
}
if let Some(v) = self.verbosity.as_deref() {
let normalized = v.trim().to_ascii_lowercase();
if !matches!(normalized.as_str(), "normal" | "concise") {
anyhow::bail!("Invalid verbosity '{v}': expected normal or concise.");
}
}
if let Some(mode) = self.sandbox_mode.as_deref() {
let normalized = mode.trim().to_ascii_lowercase();
if !matches!(
normalized.as_str(),
"read-only" | "workspace-write" | "danger-full-access" | "external-sandbox"
) {
anyhow::bail!(
"Invalid sandbox_mode '{mode}': expected read-only, workspace-write, danger-full-access, or external-sandbox."
);
}
}
if let Some(tui) = &self.tui
&& let Some(mode) = tui.alternate_screen.as_deref()
{
let mode = mode.to_ascii_lowercase();
if !matches!(mode.as_str(), "auto" | "always" | "never") {
anyhow::bail!(
"Invalid tui.alternate_screen '{mode}': expected auto, always, or never."
);
}
}
if let Some(transcript) = &self.transcript
&& let Err(detail) = transcript.prose_measure_columns()
{
anyhow::bail!("Invalid transcript.prose_measure: {detail}.");View on GitHub (pinned to 73e0f67d83)