n8n-io/n8n · error · NodeOperationError

The "text" parameter is empty.

Error message

The "text" parameter is empty.

What it means

Thrown per-item inside Tools Agent V2's batch loop when getPromptInputByType returns undefined for that item's prompt. Same caveat as 648: the helper throws its own 'No prompt specified' before returning undefined, so this exact message is effectively unreachable in stock code.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts:315

			);
		}

		// Check if streaming is enabled
		enableStreaming = this.getNodeParameter('options.enableStreaming', 0, true) as boolean;

		for (let i = 0; i < items.length; i += batchSize) {
			const batch = items.slice(i, i + batchSize);
			const batchPromises = batch.map(async (_item, batchItemIndex) => {
				const itemIndex = i + batchItemIndex;

				const input = getPromptInputByType({
					ctx: this,
					i: itemIndex,
					inputKey: 'text',
					promptTypeKey: 'promptType',
				});
				if (input === undefined) {
					throw new NodeOperationError(this.getNode(), 'The "text" parameter is empty.');
				}
				const outputParser = await getOptionalOutputParser(this, itemIndex);
				const tools = await getTools(this, outputParser);
				const options = this.getNodeParameter('options', itemIndex, {}) as {
					systemMessage?: string;
					maxIterations?: number;
					returnIntermediateSteps?: boolean;
					passthroughBinaryImages?: boolean;
					passthroughBinaryPdfs?: boolean;
					tracingMetadata?: { values?: Array<{ key: string; value: unknown }> };
				};

				// Prepare the prompt messages and prompt template.
				const messages = await prepareMessages(this, itemIndex, {
					systemMessage: options.systemMessage,
					passthroughBinaryImages: options.passthroughBinaryImages ?? true,
					passthroughBinaryPdfs: options.passthroughBinaryPdfs ?? false,
					outputParser,

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Populate the prompt parameter for every item in the batch.
  2. Upgrade to Tools Agent V3.
  3. If running a fork, ensure the helper throws on undefined.
Defensive patterns

Strategy: validation

Validate before calling

const input = getPromptInputByType({ ctx: this, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });
if (input === undefined || (typeof input === 'string' && input.trim() === '')) {
  throw new NodeOperationError(this.getNode(), `Tools Agent prompt is empty for item ${itemIndex}.`);
}

Type guard

function hasPrompt(value: unknown): value is string {
  return typeof value === 'string' && value.trim().length > 0;
}

Prevention

When it happens

Trigger: An item in the batch has an empty prompt (theoretically). In practice the helper throws first.

Common situations: Same as 648 — should not surface in stock n8n; possible only with a forked helper that returns undefined.

Related errors


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