zed-industries/zed · error

should be an object

Error message

should be an object

What it means

Asserts an internal invariant while converting a JSON schema path into nested schema objects: an intermediate entry inserted as {"type":"object","properties":{}} must be a JSON object when re-entered via .as_object_mut. It can only fail if a concurrently-inserted value under the same key is a non-object (e.g., a leaf schema placed where a container was expected) — i.e., a name collision between a leaf setting and an object setting in dotted paths.

Source

Thrown at crates/languages/src/python.rs:2414

                            schema_entry.insert(
                                "type".to_string(),
                                serde_json::Value::String(json_type.to_string()),
                            );
                        }
                    }

                    current.insert(part.to_string(), serde_json::Value::Object(schema_entry));
                } else {
                    let next_current = current
                        .entry(part.to_string())
                        .or_insert_with(|| {
                            serde_json::json!({
                                "type": "object",
                                "properties": {}
                            })
                        })
                        .as_object_mut()
                        .expect("should be an object")
                        .entry("properties")
                        .or_insert_with(|| serde_json::json!({}))
                        .as_object_mut()
                        .expect("properties should be an object");

                    current = next_current;
                }
            }
        }

        serde_json::json!({
            "type": "object",
            "properties": root_properties
        })
    }
}

#[cfg(target_os = "macos")]

View on GitHub (pinned to f4178619ac)

Solutions

  1. Detect the collision and log both the offending path and existing value type before converting
  2. Skip or rename the conflicting leaf key so container/leaf roles never collide
  3. Use entry() with a match to merge rather than unwrap when the existing value is already present
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/languages/src/python.rs:2414 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/149032a0017de9d4. Report an issue: GitHub.