n8n-io/n8n · error · NodeOperationError

Error during parsing of JSON Schema. ${error}

Error message

Error during parsing of JSON Schema. 
 ${error}

What it means

Thrown by the Call Workflow Tool v1 in supplyData when 'Specify Input Schema' is on and either generateSchemaFromExample (fromJson mode) or jsonParse of the manual schema or convertJsonSchemaToZod throws. The tool cannot build the structured-tool schema, so initialization fails before any run.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/tools/ToolWorkflow/v1/ToolWorkflowV1.node.ts:229

				// We initialize these even though one of them will always be empty
				// it makes it easier to navigate the ternary operator
				const jsonExample = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;
				const inputSchema = this.getNodeParameter('inputSchema', itemIndex, '') as string;

				const schemaType = this.getNodeParameter('schemaType', itemIndex) as 'fromJson' | 'manual';
				const jsonSchema =
					schemaType === 'fromJson'
						? generateSchemaFromExample(jsonExample)
						: jsonParse<JSONSchema7>(inputSchema);

				const zodSchema = convertJsonSchemaToZod<DynamicZodObject>(jsonSchema);

				tool = new DynamicStructuredTool({
					schema: zodSchema,
					...functionBase,
				});
			} catch (error) {
				throw new NodeOperationError(
					this.getNode(),
					'Error during parsing of JSON Schema. \n ' + error,
				);
			}
		} else {
			tool = new DynamicTool(functionBase);
		}

		return {
			response: tool,
		};
	}
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. If using 'From JSON', paste a clean, parseable JSON example (validate it in a linter).
  2. If using 'Manual', validate the JSON Schema against draft-07 and simplify unsupported constructs.
  3. Remove $ref / complex compositions and inline the definitions.
  4. Turn off 'Specify Input Schema' to fall back to an unstructured DynamicTool.

Example fix

// before: jsonSchemaExample = "{ name: 'x', }" (unquoted keys, trailing comma) → throws
// after:
jsonSchemaExample = '{"name":"x","age":30}'
// or disable 'Specify Input Schema' to skip schema parsing.
Defensive patterns

Strategy: try-catch

Validate before calling

const example = this.getNodeParameter('jsonSchemaExample', itemIndex, '') as string;
if (schemaType === 'fromJson' && example) {
  try { JSON.parse(example); } catch (e) { throw new Error(`Example JSON invalid: ${e.message}`); }
}

Type guard

function isValidJsonSchema(s: string): boolean {
  try { const o = JSON.parse(s); return typeof o === 'object' && o !== null; } catch { return false; }
}

Try / catch

try { zodSchema = convertJsonSchemaToZod(jsonSchema); }
catch (e) { /* fall back to unstructured DynamicTool */ }

Prevention

When it happens

Trigger: Schema Type 'From JSON' with an example that isn't valid JSON or that yields an unsupported schema; Schema Type 'Manual' with a JSON Schema that violates draft-07 (bad types, circular refs, unsupported keywords); zod conversion choking on the inferred schema.

Common situations: Hand-writing a JSON Schema and getting a keyword wrong; pasting an example object with trailing commas; using advanced JSON Schema features ($ref, oneOf-of-mixed-types) the converter doesn't support.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/409dbe82364a83ad. Report an issue: GitHub.