Hmbown/CodeWhale · error

Failed to update setting: invalid synchronized_output

Error message

Failed to update setting: invalid synchronized_output '{value}'. Expected: auto, on, off.

What it means

Settings::set validates the `synchronized_output` (aliases sync_output, sync) value via normalize_synchronized_output and rejects anything outside ["auto", "on", "off"]. This setting controls synchronized terminal rendering; an invalid value would break the tri-state handling downstream, so the setter refuses it up front.

Solutions

  1. Use exactly auto, on, or off.
  2. Prefer `auto` unless debugging rendering artifacts (terminal tearing).
  3. Check normalize_synchronized_output for accepted casing and whitespace.

Example fix

// before
settings.set("synchronized_output", "true")?;
// after
settings.set("synchronized_output", "on")?;
Defensive patterns

Strategy: validation

Validate before calling

fn valid_sync_output(v: &str) -> bool {
    matches!(v.trim().to_ascii_lowercase().as_str(), "auto" | "on" | "off")
}

Try / catch

if let Err(e) = settings.set("synchronized_output", value) {
    if e.to_string().contains("invalid synchronized_output") { value = "auto".into(); settings.set("synchronized_output", &value)?; }
    else { return Err(e); }
}

Prevention

When it happens

Trigger: Settings::set("synchronized_output", v) / set("sync", v) where v normalizes outside auto|on|off — e.g. `sync true`, `sync yes`, or `sync Auto` if the normalizer is case-sensitive.

Common situations: Users typing boolean words (true/false/yes/no) instead of the tri-state keywords, or scripting /config commands in dotfiles with wrong casing.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/df01dc536ba6f938. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/settings.rs:1687

                    anyhow::bail!(
                        "Failed to update setting: invalid transcript spacing '{value}'. Expected: compact, comfortable, spacious."
                    );
                }
                self.transcript_spacing = normalized.to_string();
            }
            "status_indicator" | "indicator" => {
                let normalized = normalize_status_indicator(value);
                if !["cw", "whale", "dots", "off"].contains(&normalized) {
                    anyhow::bail!(
                        "Failed to update setting: invalid status indicator '{value}'. Expected: cw, whale, dots, off."
                    );
                }
                self.status_indicator = normalized.to_string();
            }
            "synchronized_output" | "sync_output" | "sync" => {
                let normalized = normalize_synchronized_output(value);
                if !["auto", "on", "off"].contains(&normalized) {
                    anyhow::bail!(
                        "Failed to update setting: invalid synchronized_output '{value}'. Expected: auto, on, off."
                    );
                }
                self.synchronized_output = normalized.to_string();
            }
            "workspace_follow_symlinks" | "follow_symlinks" => {
                self.workspace_follow_symlinks = parse_bool(value)?;
            }
            "default_mode" | "mode" => {
                // Act (wire: agent), Plan, and Operate are valid startup modes.
                // yolo remains a permission-migration alias, not a mode write.
                self.default_mode = match value.trim().to_ascii_lowercase().as_str() {
                    "agent" | "normal" | "act" | "work" | "edit" => "agent".to_string(),
                    "plan" => "plan".to_string(),
                    "operate" | "operation" | "ops" => "operate".to_string(),
                    _ => anyhow::bail!(
                        "Failed to update setting: invalid mode '{value}'. Expected: act (agent), plan, or operate."
                    ),

View on GitHub (pinned to 73e0f67d83)