colinhacks/zod · error · Error
unevaluatedProperties is not supported
Error message
unevaluatedProperties is not supported
What it means
Thrown by convertBaseSchema when the input contains `unevaluatedProperties`. Like unevaluatedItems, this keyword only has meaning relative to evaluated applicators and cannot be statically lowered into Zod's object/record/catchall model.
Source
Thrown at packages/zod/src/v4/classic/from-json-schema.ts:159
}
throw new Error(`Reference not found: ${ref}`);
}
function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext): ZodType {
// Handle unsupported features
if (schema.not !== undefined) {
// Special case: { not: {} } represents never
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
return z.never();
}
throw new Error("not is not supported in Zod (except { not: {} } for never)");
}
if (schema.unevaluatedItems !== undefined) {
throw new Error("unevaluatedItems is not supported");
}
if (schema.unevaluatedProperties !== undefined) {
throw new Error("unevaluatedProperties is not supported");
}
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
throw new Error("Conditional schemas (if/then/else) are not supported");
}
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
throw new Error("dependentSchemas and dependentRequired are not supported");
}
// Handle $ref
if (schema.$ref) {
const refPath = schema.$ref;
if (ctx.refs.has(refPath)) {
return ctx.refs.get(refPath)!;
}
if (ctx.processing.has(refPath)) {
// Circular reference - use lazy
return z.lazy(() => {View on GitHub (pinned to 912f0f51b0)
Solutions
- Drop `unevaluatedProperties` and rely on `additionalProperties: false` (which the converter supports as `.strict()`).
- Inline composed schemas so all properties are visible to the object converter, then use `additionalProperties: false`.
- Strip the keyword in a pre-pass if your use case tolerates the looser behaviour.
Example fix
// before
{ "allOf": [{ ... }], "unevaluatedProperties": false }
// after
{ "type": "object", "properties": { ... }, "additionalProperties": false } Defensive patterns
Strategy: validation
Validate before calling
function stripUnsupported(schema: any) {
if (schema.unevaluatedProperties !== undefined) {
delete schema.unevaluatedProperties;
}
} Type guard
function hasUnevaluatedProperties(s: any): boolean { return s?.unevaluatedProperties !== undefined; } Prevention
- Prefer `additionalProperties: false` over `unevaluatedProperties: false`.
- Inline `allOf` composition before conversion so all properties are visible.
- Validate incoming schemas against an allow-list of supported keywords.
When it happens
Trigger: Schemas using `unevaluatedProperties: false` (typically to forbid any property not explicitly validated, including those surfaced via allOf/$ref).
Common situations: Strict-mode JSON Schemas from API style guides; auto-generated schemas from TypeScript types with `additionalProperties: false` plus composition; draft-2020-12 strict profiles.
Related errors
- not is not supported in Zod (except { not: {} } for never)
- unevaluatedItems is not supported
- Conditional schemas (if/then/else) are not supported
- dependentSchemas and dependentRequired are not supported
- Unsupported type: ${type}
AI-assisted analysis of colinhacks/zod@912f0f51b0 (2026-08-03).
Data as JSON: /data/errors/feda1447c554dd47.json.
Report an issue: GitHub.