zed-industries/zed · error

Expected auto_indent to be a boolean or valid enum value

Error message

Expected auto_indent to be a boolean or valid enum value

What it means

Settings migration guard: auto_indent had a value that is neither Bool(true), Bool(false), nor one of the accepted legacy strings, so it cannot be mapped to the new enum representation. The user's settings.json (or a language override) contains a corrupt/unexpected auto_indent value.

Source

Thrown at crates/migrator/src/migrations/m_2025_01_27/settings.rs:24

pub fn make_auto_indent_an_enum(value: &mut Value) -> Result<()> {
    migrate_language_setting(value, migrate_auto_indent)
}

fn migrate_auto_indent(value: &mut Value, _path: &[&str]) -> Result<()> {
    let Some(auto_indent) = value
        .as_object_mut()
        .and_then(|obj| obj.get_mut("auto_indent"))
    else {
        return Ok(());
    };

    *auto_indent = match auto_indent {
        Value::Bool(true) => Value::String("syntax_aware".to_string()),
        Value::Bool(false) => Value::String("none".to_string()),
        Value::String(s) if s == "syntax_aware" || s == "preserve_indent" || s == "none" => {
            return Ok(());
        }
        _ => anyhow::bail!("Expected auto_indent to be a boolean or valid enum value"),
    };
    Ok(())
}

View on GitHub (pinned to f4178619ac)

Solutions

  1. Edit settings.json and set auto_indent to a boolean or one of the valid enum values (e.g. "syntax_aware", "none")
  2. Remove the auto_indent key to fall back to the default
  3. Fix any JSON syntax errors around the setting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/migrator/src/migrations/m_2025_01_27/settings.rs:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/c1adacf5926e2ae9. Report an issue: GitHub.