n8n-io/n8n · error

OPENAI_STRUCTURED_OUTPUT_SCHEMA_INVALID

OPENAI_STRUCTURED_OUTPUT_SCHEMA_INVALID

Error message

OpenAI node output format is "JSON Schema", but the schema value is not a string. The node passes the raw value through JSON.parse and throws "Failed to parse schema" at runtime. Serialize the schema to a JSON string in textFormat.textOptions.schema.

What it means

Error "OpenAI node output format is "JSON Schema", but the schema value is not a string. The node passes the raw value through JSON.parse and throws "Failed to parse schema" at runtime. Serialize the schema to a JSON string in textFormat.textOptions.schema." thrown in n8n-io/n8n.

Source

Thrown at packages/@n8n/instance-ai/src/tools/workflows/detect-unparseable-openai-schema.ts:69

				code: 'OPENAI_STRUCTURED_OUTPUT_IGNORED',
				nodeName,
				message:
					'OpenAI node stores textFormat.textOptions as an ARRAY. At runtime the node reads that path as an object, ' +
					'so the JSON Schema output format is silently ignored and the node returns plain text. ' +
					'Store textOptions as a single object: textFormat: { textOptions: { type: "json_schema", name, schema } }.',
			});
			continue;
		}

		const schema = resolved.options.schema;
		if (schema === undefined || schema === null) continue;
		// n8n treats a value as an expression only when its FIRST character is '='.
		if (typeof schema === 'string' && schema.startsWith('=')) continue;
		if (typeof schema === 'string' && schema.trim().length === 0) continue;

		if (typeof schema !== 'string') {
			warnings.push({
				code: 'OPENAI_STRUCTURED_OUTPUT_SCHEMA_INVALID',
				nodeName,
				message:
					'OpenAI node output format is "JSON Schema", but the schema value is not a string. ' +
					'The node passes the raw value through JSON.parse and throws "Failed to parse schema" at runtime. ' +
					'Serialize the schema to a JSON string in textFormat.textOptions.schema.',
			});
			continue;
		}

		let parsed: unknown;
		try {
			parsed = JSON.parse(schema);
		} catch (error) {
			warnings.push({
				code: 'OPENAI_STRUCTURED_OUTPUT_SCHEMA_INVALID',
				nodeName,
				message:
					'OpenAI node output format is "JSON Schema", but the schema string is not valid JSON ' +

View on GitHub (pinned to 5ac6606e81)

When it happens

Trigger: Thrown at packages/@n8n/instance-ai/src/tools/workflows/detect-unparseable-openai-schema.ts:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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