n8n-io/n8n · error · NodeOperationError

${error.message}

Error message

${error.message}

What it means

The v1 router's main execution loop catches errors from individual item processing. If the error is not a NodeApiError (which gets custom message handling), and continueOnFail is not enabled, the error is wrapped in a NodeOperationError with itemIndex context and the original description. This is the catch-all error wrapper ensuring every failure carries item-level context. For non-Error throws (e.g. a string or plain object), passing error directly to NodeOperationError may produce unexpected message formatting.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vendors/OpenAi/v1/actions/router.ts:80

			if (error instanceof NodeApiError) {
				// If the error is a rate limit error, we want to handle it differently
				const errorCode: string | undefined = (error.cause as any)?.error?.error?.code;
				if (errorCode) {
					const customErrorMessage = getCustomErrorMessage(errorCode);
					if (customErrorMessage) {
						error.message = customErrorMessage;
					}
				}

				error.context = {
					itemIndex: i,
				};

				throw error;
			}

			throw new NodeOperationError(this.getNode(), error, {
				itemIndex: i,
				description: error.description,
			});
		}
	}

	return [returnData];
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Inspect the error.description and error.message fields — the original error is preserved as the cause/message
  2. Enable 'Continue On Fail' in the node settings to collect all errors without stopping execution
  3. Identify which item (itemIndex in error.context) triggered the failure and inspect that specific input item

Example fix

// Enable 'Continue On Fail' to collect errors instead of stopping:
// In node settings → Settings tab → toggle 'Continue On Fail'
Defensive patterns

Strategy: try-catch

Try / catch

// Enable continueOnFail to handle errors per-item
try {
  const result = await execute.call(this, i);
  returnData.push(...result);
} catch (error) {
  if (this.continueOnFail()) {
    returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
    continue;
  }
  if (error instanceof NodeApiError) throw error;
  throw new NodeOperationError(this.getNode(), error, { itemIndex: i });
}

Prevention

When it happens

Trigger: Any error thrown by a sub-operation (assistant, audio, file, image, text) that is not a NodeApiError and continueOnFail is not enabled. The catch block wraps it with itemIndex. If the thrown value is not a standard Error instance, passing it as the message to NodeOperationError can produce '[object Object]' or similar.

Common situations: A sub-operation throws a plain Error or a non-Error value; a third-party library error bubbles up through the operation; assertion failures in the sub-operation logic.

Related errors


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