Hmbown/CodeWhale · error
Invalid tui.alternate_screen
Error message
Invalid tui.alternate_screen '{mode}': expected auto, always, or never. What it means
The `tui.alternate_screen` config option controls whether the TUI uses the terminal's alternate screen buffer. It accepts exactly `auto`, `always`, or `never`; any other value fails config validation.
Solutions
- Set `tui.alternate_screen = "auto"` (recommended default).
- Use `"always"` or `"never"` for explicit control.
- Remove the key so the TUI default applies.
Example fix
// before (config.toml) [tui] alternate_screen = "true" // after [tui] alternate_screen = "auto"
Defensive patterns
Strategy: validation
Validate before calling
assert!(matches!(mode.to_ascii_lowercase().as_str(), "auto" | "always" | "never"), "bad tui.alternate_screen: {mode}"); Prevention
- This is a tri-state string, not a boolean — never write true/false/yes/on.
- Leave it unset for `auto` behavior.
When it happens
Trigger: `Config::validate` runs with `self.tui` set and `tui.alternate_screen` lowercased is not one of `auto` | `always` | `never`.
Common situations: Typing boolean-like values (`true`, `false`, `yes`, `on`) into a tri-state option; typos such as `alway`; copying values from a tool that uses booleans for this setting.
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
- Failed to update setting: invalid composer density
- Failed to update setting: invalid focus texture
- Failed to update setting: invalid transcript spacing
- Failed to update setting: invalid work surface placement
- Failed to update setting: invalid workbar panel
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/89828c75376ba82d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/config.rs:5193
}
}
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}.");
}
if let Some(auto_review) = &self.auto_review {
auto_review.validate()?;
}
if let Some(providers) = &self.providers {
providers.validate()?;
}
Ok(())
}
View on GitHub (pinned to 73e0f67d83)