windmill-labs/windmill · error

Field properties should be an object

Error message

Field properties should be an object

What it means

During JSON-schema ingestion, `SchemaValidationRule::from_primitive` found a `properties` key on an object-typed schema whose value is not a JSON object. The parser expects `{ "properties": { name: <schema> } }`; anything else (string, array, number) cannot be turned into per-field validation rules, so parsing fails.

Source

Thrown at backend/windmill-common/src/schema.rs:77

                    if encoding == "base64" {
                        schema_rules.push(SchemaValidationRule::IsBytes);
                    }
                }
            }

            JsonPrimitiveType::Number => {
                schema_rules.push(SchemaValidationRule::IsNumber);
            }
            JsonPrimitiveType::Integer => {
                schema_rules.push(SchemaValidationRule::IsInteger);
            }
            JsonPrimitiveType::Object => {
                let mut obj_rules = vec![];

                if let Some(properties) = val.get("properties") {
                    let properties = properties
                        .as_object()
                        .ok_or(anyhow!("Field properties should be an object"))?;

                    for (key, v) in properties {
                        obj_rules.push((key.clone(), SchemaValidationRule::from_value(v)?))
                    }

                    schema_rules.push(SchemaValidationRule::IsObject(obj_rules));
                } else if let Some(one_of) = val.get("oneOf") {
                    let one_of = one_of
                        .as_array()
                        .ok_or(anyhow!("`oneOf` needs to be an array"))?;
                    let mut rules_map: HashMap<String, Vec<SchemaValidationRule>> = HashMap::new();

                    for variant in one_of {
                        let variant_label = variant
                            .get("title")
                            .ok_or(anyhow!(
                                "oneOf variant definition should have a `title` field"
                            ))?

View on GitHub (pinned to e474e8803c)

Solutions

  1. Change `properties` to a JSON object mapping field names to schema definitions.
  2. If you meant a union of shapes, use `oneOf`/`anyOf` instead of a non-object `properties`.
  3. Validate the JSON schema with a standard validator (e.g. jsonschema) before deploying.

Example fix

// before
{ "type": "object", "properties": ["a", "b"] }
// after
{ "type": "object", "properties": { "a": { "type": "string" }, "b": { "type": "number" } } }
Defensive patterns

Strategy: validation

Validate before calling

const s = JSON.parse(schemaRaw);
if (s.type === "object" && "properties" in s && (typeof s.properties !== "object" || s.properties === null || Array.isArray(s.properties))) {
  throw new Error("`properties` must be an object mapping field names to schemas");
}

Type guard

function hasValidProperties(s) {
  return typeof s === "object" && s !== null &&
    (typeof s.properties !== "undefined" ? (typeof s.properties === "object" && !Array.isArray(s.properties)) : true);
}

Try / catch

try {
  deployScript({ schema });
} catch (e) {
  if (String(e.message).includes("properties should be an object")) {
    console.error("Fix the JSON schema: `properties` must be an object", e);
  } else throw e;
}

Prevention

When it happens

Trigger: Deploying a script/flow/app whose input schema (or app JSON schema) declares `type: "object"` with a `properties` field that is not a mapping, e.g. `"properties": "..."` or `"properties": []`.

Common situations: Hand-edited JSON schemas, code-generated schemas with a malformed `properties` node, copy-paste errors, or tools emitting draft-schema features Windmill's parser does not accept.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/2332a1922146d967. Report an issue: GitHub.