zed-industries/zed · error

The `code_actions_on_format` is in an invalid state and cann

Error message

The `code_actions_on_format` is in an invalid state and cannot be migrated at {}. Please ensure the code_actions_on_format setting is a Map<String, bool>

What it means

Migration guard: code_actions_on_format exists but is not a JSON object map of string keys to booleans, so the migration cannot rewrite it. The user's settings contain a malformed value (e.g. a string, array, or non-bool entries).

Source

Thrown at crates/migrator/src/migrations/m_2025_10_16/settings.rs:26

}

fn restore_code_actions_on_format_inner(value: &mut Value, path: &[&str]) -> Result<()> {
    let Some(obj) = value.as_object_mut() else {
        return Ok(());
    };
    let code_actions_on_format = obj
        .get("code_actions_on_format")
        .cloned()
        .unwrap_or_else(|| Value::Object(Default::default()));

    fn fmt_path(path: &[&str], key: &str) -> String {
        let mut path = path.to_vec();
        path.push(key);
        path.join(".")
    }

    let Some(mut code_actions_map) = code_actions_on_format.as_object().cloned() else {
        anyhow::bail!(
            r#"The `code_actions_on_format` is in an invalid state and cannot be migrated at {}. Please ensure the code_actions_on_format setting is a Map<String, bool>"#,
            fmt_path(path, "code_actions_on_format"),
        );
    };

    let Some(formatter) = obj.get("formatter") else {
        return Ok(());
    };
    let formatter_array = if let Some(array) = formatter.as_array() {
        array.clone()
    } else {
        vec![formatter.clone()]
    };
    if formatter_array.is_empty() {
        return Ok(());
    }
    let mut code_action_formatters = Vec::new();
    for formatter in formatter_array {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Open settings.json at the reported path and make code_actions_on_format an object mapping action names to booleans
  2. Remove the invalid code_actions_on_format key and re-add it in the new format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/migrator/src/migrations/m_2025_10_16/settings.rs:26 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/6ab168d1a84182d2. Report an issue: GitHub.