n8n-io/n8n · error · NodeOperationError

The ‘text parameter is empty.

Error message

The ‘text parameter is empty.

What it means

Thrown by the Conversational Agent execute loop when the resolved input/prompt text is undefined. The node reads 'text' either directly (typeVersion <= 1.2) or via getPromptInputByType for newer versions; if the result is undefined there is no prompt to send to the agent, so execution aborts for that item.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ConversationalAgent/execute.ts:95

	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. Provide a non-empty value (or a valid expression) in the node's text/prompt field.
  2. Ensure referenced fields exist on the incoming item, or default them with a Set node upstream.
  3. Use a fallback expression that yields a safe default instead of undefined, e.g. {{$json.prompt || 'default'}}.

Example fix

// before: text = {{$json.nonExistent}}  -> undefined
// after: text = {{$json.prompt || 'Summarize the following: ' + $json.input}}
Defensive patterns

Strategy: validation

Validate before calling

const input = getPromptInputByType({ ctx, i, inputKey: 'text', promptTypeKey: 'promptType' });
if (input === undefined || input === '') throw new Error('Provide a non-empty prompt');

Type guard

function hasPromptText(s): s is string { return typeof s === 'string' && s.length > 0; }

Prevention

When it happens

Trigger: After resolving `input` (either getNodeParameter('text', itemIndex) or getPromptInputByType), `if (input === undefined)` throws NodeOperationError with the message 'The \u2018text parameter is empty.' (note the literal curly quote). Fires when the text/prompt field is unset, references an expression that yields undefined, or the input key is misconfigured.

Common situations: Empty 'text' / prompt field on the node; an expression like {{$json.missingField}} that resolves to undefined; item without the field the prompt references; switching promptType without providing the corresponding input value.

Related errors


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