{"record":{"id":"35a5be3fd0e875ca","repo":"ComposioHQ/composio","slug":"failed-to-convert-json-schema-to-zod-schema","errorCode":null,"errorMessage":"Failed to convert JSON Schema to Zod Schema","messagePattern":"Failed to convert JSON Schema to Zod Schema","errorType":"exception","errorClass":"JsonSchemaToZodError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/utils/jsonSchema.ts","lineNumber":498,"sourceCode":"  }\n): T {\n  try {\n    let schema = jsonSchema;\n    // Remove all non-required properties from the schema if strict is true\n    if (strict && schema) {\n      schema = removeNonRequiredProperties(\n        schema as {\n          type: 'object';\n          properties: Record<string, unknown>;\n          required?: string[] | undefined;\n        }\n      );\n    }\n    // Convert the JSON schema properties to Zod schema\n    const zodSchema = jsonSchemaToZod(schema) as T;\n    return zodSchema;\n  } catch (error) {\n    throw new JsonSchemaToZodError('Failed to convert JSON Schema to Zod Schema', {\n      cause: error,\n    });\n  }\n}\n\n/**\n * Reason recorded when strict normalization rewrites a schema node. Every\n * rewrite is lossless: the model can still express the same values.\n *\n * - `optional-property-nullable` — a property missing from `required` was\n *   added to it and widened to accept `null`, the emulation of optional\n *   fields that OpenAI structured outputs document.\n * - `unsupported-keyword-stripped` — an annotation keyword the API rejects\n *   (`default`, `examples`) was removed.\n * - `one-of-converted` — `oneOf` (unsupported) became `anyOf`.\n */\nexport type StrictSchemaChangeReason =\n  'optional-property-nullable' | 'unsupported-keyword-stripped' | 'one-of-converted';","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/utils/jsonSchema.ts#L480-L516","documentation":"jsonSchemaToZodSchema wraps any failure of the underlying jsonSchemaToZod conversion (unsupported keywords, malformed schema) in JsonSchemaToZodError with the original error as cause. The converted schema backs inputZodSchema/parameters validation on tools.","triggerScenarios":"Accessing tool.parameters/inputParametersSchema or executing validation for a tool whose JSON Schema uses constructs the converter cannot map (e.g. unsupported keywords, invalid types, bad $refs).","commonSituations":"See trigger scenarios.","solutions":["Inspect error.cause for the real conversion failure.","Fix or simplify the offending schema keyword; the converter supports a JSON-Schema subset.","Avoid schema features outside the supported subset (patternProperties with complex patterns, exotic formats, etc.)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const z = tool.inputParametersSchema; } catch (e) {\n  if (e instanceof JsonSchemaToZodError) console.error(e.cause); // real reason\n}","preventionTips":["Stick to the supported JSON Schema subset.","Test schema conversion when adding new tool definitions."],"tags":["json-schema","zod","conversion","typescript"],"backgroundTag":"schema-conversion-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}