windmill-labs/windmill · error
Object type should have a `properties` or `anyOf` field, or
Error message
Object type should have a `properties` or `anyOf` field, or be a resource
What it means
An object-typed schema in Windmill must be one of: having `properties`, having `anyOf`, or being a resource (its `format` starts with `resource-`). A bare `{ "type": "object" }` with none of these gives the parser no rules to build, so it is rejected.
Source
Thrown at backend/windmill-common/src/schema.rs:120
variant_label.to_string(),
SchemaValidationRule::from_value(variant)?,
);
} else {
return Err(anyhow!(
"oneOf definition has a duplicate variant `{variant_label}`"
));
}
}
schema_rules.push(SchemaValidationRule::IsOneOf(rules_map))
} else {
let is_resource = val
.get("format")
.and_then(|f| f.as_str())
.map(|f| f.starts_with("resource"))
.unwrap_or(false);
if !is_resource {
return Err(anyhow!(
"Object type should have a `properties` or `anyOf` field, or be a resource"
));
}
}
}
JsonPrimitiveType::Array => {
let items = val
.get("items")
.ok_or(anyhow!("Array type should have field `items`"))?;
let arr_rules = SchemaValidationRule::from_value(items)?;
schema_rules.push(SchemaValidationRule::IsArray(arr_rules));
}
JsonPrimitiveType::Boolean => {
schema_rules.push(SchemaValidationRule::IsBool);
}
JsonPrimitiveType::Null => {View on GitHub (pinned to e474e8803c)
Solutions
- If arbitrary key/value input is needed, use `"format": "resource-windmill-u-py"`-style resource typing or define the fields under `properties`.
- Add a `properties` object describing the expected fields (even one).
- Use `anyOf` with concrete object variants.
- Change the primitive to `string` if the value is actually unstructured.
Example fix
// before
{ "type": "object" }
// after
{ "type": "object", "properties": { "name": { "type": "string" } } } Defensive patterns
Strategy: validation
Validate before calling
const s = JSON.parse(schemaRaw);
const isResource = typeof s.format === "string" && s.format.startsWith("resource");
if (s.type === "object" && !s.properties && !s.anyOf && !isResource) {
throw new Error("Object schema needs `properties`, `anyOf`, or a resource-* format");
} Type guard
function isWellFormedObjectSchema(s) {
const isResource = typeof s?.format === "string" && s.format.startsWith("resource");
return s?.type !== "object" || Boolean(s.properties || s.anyOf || isResource);
} Try / catch
try {
await deploy(schema);
} catch (e) {
if (String(e.message).includes("should have a `properties` or `anyOf` field")) {
throw new Error("Declare object fields under properties, use anyOf, or set a resource-* format");
} else throw e;
} Prevention
- In Windmill, a bare `type: object` is never valid — always add properties/anyOf or a resource format.
- For free-form dicts, check current Windmill docs for the accepted pattern instead of assuming plain JSON Schema.
- Lint every input/output schema before deploying.
When it happens
Trigger: Declaring `"type": "object"` in a script/flow input schema without `properties`, without `anyOf`, and without `"format": "resource-..."`.
Common situations: Accepting arbitrary free-form JSON input; schemas copied from generic JSON Schema docs; removing properties and leaving an empty object node; wanting a dict but not knowing Windmill requires a resource format or properties.
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
- Field properties should be an object
- `oneOf` needs to be an array
- oneOf variant definition should have a `title` field
- oneOf variant definition `title` field should be a string
- Array type should have field `items`
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/6453b46f0a176e5a.
Report an issue: GitHub.