n8n-io/n8n · error · NodeOperationError

The ‘text‘ parameter is empty.

Error message

The ‘text‘ parameter is empty.

What it means

Thrown by the ReAct Agent under the same conditions as 640: the prompt input resolved to undefined. Like 640, for typeVersion > 1.2 the getPromptInputByType helper throws its own 'No prompt specified' error first, so this exact message is effectively only reachable on the legacy v1.2 branch.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ReActAgent/execute.ts:103

	const items = this.getInputData();
	for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
		try {
			let input;

			if (this.getNode().typeVersion <= 1.2) {
				input = this.getNodeParameter('text', itemIndex) as string;
			} else {
				input = getPromptInputByType({
					ctx: this,
					i: itemIndex,
					inputKey: 'text',
					promptTypeKey: 'promptType',
				});
			}

			if (input === undefined) {
				throw new NodeOperationError(this.getNode(), 'The ‘text‘ parameter is empty.');
			}

			if (prompt) {
				input = (await prompt.invoke({ input })).value;
			}

			const response = await agentExecutor
				.withConfig(tracingConfig)
				.invoke({ input, outputParser });

			if (outputParser) {
				response.output = await extractParsedOutput(this, outputParser, response.output as string);
			}

			returnData.push({ json: response });
		} catch (error) {
			throwIfToolSchema(this, error);
			const executionError = wrapLangChainParserError(error, this.getNode(), itemIndex);

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Populate the 'text' parameter with a literal string or a resolvable expression.
  2. Upgrade the ReAct Agent node to the current typeVersion to get the more actionable 'No prompt specified' message.
  3. Verify upstream node output shape if the prompt uses an expression.
Defensive patterns

Strategy: validation

Validate before calling

const raw = this.getNodeParameter('text', itemIndex, '') as string;
if (!raw || raw.trim() === '') {
  throw new NodeOperationError(this.getNode(), 'Prompt is empty — please provide input text.');
}

Type guard

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

Try / catch

try {
  input = getPromptInputByType({ ctx: this, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });
} catch (e) {
  throw new NodeOperationError(this.getNode(), 'Prompt could not be resolved for this item', { itemIndex, cause: e });
}

Prevention

When it happens

Trigger: ReAct Agent node (typeVersion <= 1.2) with empty 'text' parameter; expression evaluating to undefined; or a stale imported workflow missing the prompt value.

Common situations: Legacy workflow migrated between n8n versions; prompt bound to an upstream field that no longer exists; testing with a cleared prompt.

Related errors


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