n8n-io/n8n · error · NodeOperationError

Model output doesn't fit required format

Error message

Model output doesn't fit required format

What it means

Thrown by the Information Extractor when a Promise.allSettled batch promise rejected and continueOnFail is false. The rejection reason is wrapped via wrapLangChainParserError first; the wrapped error becomes a NodeOperationError. It typically means the LLM output could not be parsed into the required structured schema even after the OutputFixingParser retry.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/chains/InformationExtractor/InformationExtractor.node.ts:305

				const batch = items.slice(i, i + batchSize);
				const batchPromises = batch.map(async (_item, batchItemIndex) => {
					const itemIndex = i + batchItemIndex;
					return await processItem(this, itemIndex, llm, parser);
				});

				const batchResults = await Promise.allSettled(batchPromises);

				batchResults.forEach((response, index) => {
					if (response.status === 'rejected') {
						const error = wrapLangChainParserError(response.reason, this.getNode(), i + index);
						if (this.continueOnFail()) {
							resultData.push({
								json: { error: error.message },
								pairedItem: { item: i + index },
							});
							return;
						} else {
							throw new NodeOperationError(this.getNode(), error);
						}
					}
					const output = response.value;
					resultData.push({ json: { output } });
				});

				// Add delay between batches if not the last batch
				if (i + batchSize < items.length && delayBetweenBatches > 0) {
					await sleep(delayBetweenBatches);
				}
			}
		} else {
			// Sequential processing
			for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
				try {
					const output = await processItem(this, itemIndex, llm, parser);
					resultData.push({ json: { output } });
				} catch (error) {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Enable 'Continue On Fail' on the node so rejected items return an error JSON instead of aborting the whole run.
  2. Reduce the schema complexity or make fields optional so the parser can succeed more often.
  3. Use a stronger / instruction-tuned model that follows JSON schema reliably.
  4. Improve the system prompt template to clearly specify the required output format.
  5. Lower the model temperature to reduce output variability.

Example fix

// before — aborts the whole run on first rejection
if (response.status === 'rejected') {
  const error = wrapLangChainParserError(response.reason, this.getNode(), i + index);
  if (this.continueOnFail()) {
    resultData.push({ json: { error: error.message }, pairedItem: { item: i + index } });
    return;
  } else {
    throw new NodeOperationError(this.getNode(), error);
  }
}

// after — default to per-item error so one bad item does not kill the batch
if (response.status === 'rejected') {
  const error = wrapLangChainParserError(response.reason, this.getNode(), i + index);
  resultData.push({ json: { error: error.message, raw: String(response.reason) }, pairedItem: { item: i + index } });
  if (!this.continueOnFail()) {
    throw new NodeOperationError(this.getNode(), error);
  }
  return;
}
Defensive patterns

Strategy: fallback

Validate before calling

// Pre-flight: confirm schema is non-trivial and model is connected
if (!llm) throw new Error('Connect a chat model');
if (schemaType === 'fromAttributes' && attributes.length === 0) {
  throw new Error('Add attributes before running extraction');
}

Try / catch

try {
  const result = await parser.parse(llmOutput);
} catch (e) {
  // Enable continueOnFail so the item gets an error JSON instead of aborting the batch
  resultData.push({ json: { error: (e as Error).message }, pairedItem: { item: i + index } });
}

Prevention

When it happens

Trigger: For an item in the batch, the LLM returned text that the StructuredOutputParser (wrapped in OutputFixingParser) could not coerce into the Zod/JSON schema. allSettled marks the promise rejected, and since continueOnFail is off, the NodeOperationError propagates.

Common situations: The LLM is weak/instructed poorly and returns free text instead of JSON; the schema is too strict or ambiguous; the model does not support structured output well; temperature is too high causing erratic output; the system prompt template was customized poorly.

Related errors


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