{"record":{"id":"d623cbb061e6a26c","repo":"n8n-io/n8n","slug":"openai-structured-output-ignored","errorCode":"OPENAI_STRUCTURED_OUTPUT_IGNORED","errorMessage":"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 } }.","messagePattern":"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: (.+?) \\}\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/src/tools/workflows/detect-unparseable-openai-schema.ts","lineNumber":51,"sourceCode":" * - non-string schema values and unparseable JSON: the node passes the raw\n *   value through `jsonParse` per item and throws \"Failed to parse schema\";\n * - non-object schema roots: the OpenAI API rejects them for structured output.\n * All three are defects the builder never sees at build time otherwise.\n */\nexport function detectUnparseableOpenAiSchema(json: WorkflowJSON): ValidationWarning[] {\n\tconst warnings: ValidationWarning[] = [];\n\n\tfor (const node of json.nodes ?? []) {\n\t\tif (node.type !== OPENAI_NODE_TYPE) continue;\n\t\tconst params = node.parameters;\n\t\tif (!isRecord(params)) continue;\n\t\tconst resolved = getTextOptions(params);\n\t\tif (!resolved || resolved.options.type !== 'json_schema') continue;\n\t\tconst nodeName = typeof node.name === 'string' ? node.name : undefined;\n\n\t\tif (resolved.storedAsArray) {\n\t\t\twarnings.push({\n\t\t\t\tcode: 'OPENAI_STRUCTURED_OUTPUT_IGNORED',\n\t\t\t\tnodeName,\n\t\t\t\tmessage:\n\t\t\t\t\t'OpenAI node stores textFormat.textOptions as an ARRAY. At runtime the node reads that path as an object, ' +\n\t\t\t\t\t'so the JSON Schema output format is silently ignored and the node returns plain text. ' +\n\t\t\t\t\t'Store textOptions as a single object: textFormat: { textOptions: { type: \"json_schema\", name, schema } }.',\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst schema = resolved.options.schema;\n\t\tif (schema === undefined || schema === null) continue;\n\t\t// n8n treats a value as an expression only when its FIRST character is '='.\n\t\tif (typeof schema === 'string' && schema.startsWith('=')) continue;\n\t\tif (typeof schema === 'string' && schema.trim().length === 0) continue;\n\n\t\tif (typeof schema !== 'string') {\n\t\t\twarnings.push({\n\t\t\t\tcode: 'OPENAI_STRUCTURED_OUTPUT_SCHEMA_INVALID',","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/src/tools/workflows/detect-unparseable-openai-schema.ts#L33-L69","documentation":"Error \"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 } }.\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/instance-ai/src/tools/workflows/detect-unparseable-openai-schema.ts:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}