n8n-io/n8n · error · NodeOperationError

The ‘text‘ parameter is empty.

Error message

The ‘text‘ parameter is empty.

What it means

Thrown by the Plan & Execute Agent when the resolved prompt input is undefined. For node typeVersion <= 1.2 the legacy path reads the 'text' parameter directly via getNodeParameter; for newer versions it goes through getPromptInputByType. Note: getPromptInputByType itself throws 'No prompt specified' before returning undefined, so this exact message is only reachable on the legacy v1.2 branch where getNodeParameter yields undefined.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.ts:78

	}

	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);
			if (this.continueOnFail()) {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Open the Agent node and verify the 'text' / prompt field has a non-empty value or a resolvable expression.
  2. Upgrade the Agent node to the latest typeVersion so the more descriptive 'No prompt specified' error from getPromptInputByType surfaces instead.
  3. If using an expression, confirm the upstream node outputs the referenced key (e.g. $json.chatInput for auto prompt type).
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking the agent, ensure the prompt resolves to a non-empty string
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) {
  // Surface a user-facing error with the itemIndex context
  throw new NodeOperationError(this.getNode(), 'Prompt could not be resolved for this item', { itemIndex, cause: e });
}

Prevention

When it happens

Trigger: Agent node typeVersion <= 1.2 with the 'text' parameter left blank or set to an expression that resolves to undefined; or a workflow imported from an older n8n version where the prompt field was never populated.

Common situations: Upgrading an old workflow whose Agent node still runs v1.2; clearing the text field while testing; an upstream expression like {{ $json.missingKey }} returning undefined.

Related errors


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