n8n-io/n8n · error · NodeOperationError

The “text” parameter is empty.

Error message

The “text” parameter is empty.

What it means

Thrown by Tools Agent V1 when getPromptInputByType returns undefined. In practice this line is unreachable: getPromptInputByType itself throws 'No prompt specified' (with a more helpful description) before returning undefined. If you see this exact message, you are on a code path where the helper returned undefined without throwing (should not happen in shipped code).

Source

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

	const returnData: INodeExecutionData[] = [];
	const items = this.getInputData();
	const outputParser = await getOptionalOutputParser(this);
	const tools = await getTools(this, outputParser);

	for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
		try {
			const model = (await getChatModel(this)) as BaseLanguageModel;
			const memory = await getOptionalMemory(this);

			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 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. Treat as the generic empty-prompt case: populate the text parameter.
  2. If you maintain a fork, ensure getPromptInputByType throws on undefined rather than returning it.
  3. Upgrade to Tools Agent V2/V3 where this is handled centrally.
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.');
}

Type guard

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

Prevention

When it happens

Trigger: Theoretically: an empty text parameter. In practice: the helper throws first, so this message indicates either a custom fork of the helper or an internal invariant violation.

Common situations: Should not occur in stock n8n; may appear if a forked getPromptInputByType was modified to return undefined instead of throwing.

Related errors


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