{"id":"892885ff562bf460","repo":"colinhacks/zod","slug":"unevaluateditems-is-not-supported","errorCode":null,"errorMessage":"unevaluatedItems is not supported","messagePattern":"unevaluatedItems is not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/zod/src/v4/classic/from-json-schema.ts","lineNumber":156,"sourceCode":"      throw new Error(`Reference not found: ${ref}`);\n    }\n    return ctx.defs[key]!;\n  }\n\n  throw new Error(`Reference not found: ${ref}`);\n}\n\nfunction convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext): ZodType {\n  // Handle unsupported features\n  if (schema.not !== undefined) {\n    // Special case: { not: {} } represents never\n    if (typeof schema.not === \"object\" && Object.keys(schema.not).length === 0) {\n      return z.never();\n    }\n    throw new Error(\"not is not supported in Zod (except { not: {} } for never)\");\n  }\n  if (schema.unevaluatedItems !== undefined) {\n    throw new Error(\"unevaluatedItems is not supported\");\n  }\n  if (schema.unevaluatedProperties !== undefined) {\n    throw new Error(\"unevaluatedProperties is not supported\");\n  }\n  if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {\n    throw new Error(\"Conditional schemas (if/then/else) are not supported\");\n  }\n  if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {\n    throw new Error(\"dependentSchemas and dependentRequired are not supported\");\n  }\n\n  // Handle $ref\n  if (schema.$ref) {\n    const refPath = schema.$ref;\n    if (ctx.refs.has(refPath)) {\n      return ctx.refs.get(refPath)!;\n    }\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/colinhacks/zod/blob/912f0f51b0ced654d0069741e7160834dca742ee/packages/zod/src/v4/classic/from-json-schema.ts#L138-L174","documentation":"Thrown by convertBaseSchema when the input contains `unevaluatedItems`. This draft-2019+/2020-12 keyword dynamically constrains items not validated by adjacent applicators, which has no static counterpart in Zod's tuple/array model.","triggerScenarios":"A JSON Schema (draft 2019-09 or 2020-12) containing `unevaluatedItems: false` or `unevaluatedItems: { ... }`, often alongside `prefixItems` or `allOf`.","commonSituations":"Schemas authored for strict additional-item control; LLM/IDE-generated schemas using newer keywords; importing schemas from tools that emit full draft-2020-12.","solutions":["Remove the `unevaluatedItems` keyword; the converter will then treat items/tuple constraints normally.","Re-express the intent with `items: false` or an explicit `prefixItems` + `maxItems` pair where possible.","Pre-process the schema to delete unsupported keywords before passing it in."],"exampleFix":"// before\n{ \"prefixItems\": [{ \"type\": \"string\" }], \"unevaluatedItems\": false }\n\n// after\n{ \"prefixItems\": [{ \"type\": \"string\" }], \"maxItems\": 1 }","handlingStrategy":"validation","validationCode":"function stripUnsupported(schema: any) {\n  if (schema.unevaluatedItems !== undefined) {\n    delete schema.unevaluatedItems;\n  }\n}","typeGuard":"function hasUnevaluatedItems(s: any): boolean { return s?.unevaluatedItems !== undefined; }","tryCatchPattern":null,"preventionTips":["Pre-process schemas to drop unsupported draft-2019+/2020-12 keywords.","Use `items`/`prefixItems` with `maxItems` to control additional items.","Document which keywords your pipeline can handle."],"tags":["json-schema","unevaluateditems","unsupported","v4","from-json-schema"],"analyzedSha":"912f0f51b0ced654d0069741e7160834dca742ee","analyzedAt":"2026-08-03T17:41:55.908Z","schemaVersion":2}