n8n-io/n8n · error · NodeOperationError
The "text" parameter is empty.
Error message
The "text" parameter is empty.
What it means
Thrown by prepareItemContext (Tools Agent V3) when getPromptInputByType returns undefined for the current item. Same caveat as 648/652: the helper throws 'No prompt specified' first, so this message is effectively unreachable in stock code.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/prepareItemContext.ts:56
* @param response - Optional engine response with previous tool calls
* @returns ItemContext containing all item-specific state
*/
export async function prepareItemContext(
ctx: IExecuteFunctions | ISupplyDataFunctions,
itemIndex: number,
response?: EngineResponse<RequestResponseMetadata>,
model?: BaseChatModel,
): Promise<ItemContext> {
const steps = buildSteps(response, itemIndex);
const input = getPromptInputByType({
ctx,
i: itemIndex,
inputKey: 'text',
promptTypeKey: 'promptType',
});
if (input === undefined) {
throw new NodeOperationError(ctx.getNode(), 'The "text" parameter is empty.');
}
const outputParser = await getOptionalOutputParser(ctx, itemIndex);
const tools = await getTools(ctx, outputParser);
const options = ctx.getNodeParameter('options', itemIndex) as AgentOptions;
if (options.enableStreaming === undefined) {
options.enableStreaming = true;
}
// Prepare the prompt messages and prompt template.
const messages = await prepareMessages(ctx, itemIndex, {
systemMessage: options.systemMessage,
passthroughBinaryImages: options.passthroughBinaryImages ?? true,
passthroughBinaryPdfs: options.passthroughBinaryPdfs ?? false,
outputParser,
model,
});View on GitHub (pinned to 5ac6606e81)
Solutions
- Populate the prompt parameter / chatInput for every item.
- If running a fork, ensure getPromptInputByType throws on undefined.
- Verify upstream nodes emit the expected input field.
Defensive patterns
Strategy: validation
Validate before calling
const input = getPromptInputByType({ ctx, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });
if (input === undefined || (typeof input === 'string' && input.trim() === '')) {
throw new NodeOperationError(ctx.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
- Ensure every item has a non-empty prompt.
- Validate upstream output fields used by expressions.
When it happens
Trigger: Empty prompt for the item (theoretically). The helper's own error fires first in practice.
Common situations: Stock n8n: should not occur. Forked helper returning undefined: possible.
Related errors
- The “text” parameter is empty.
- The "text" parameter is empty.
- Please connect a model to the Fallback Model input or disabl
- Max iterations (${maxIterations}) reached. The agent could n
- Human-in-the-Loop nodes cannot be used inside a sub-agent. M
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/3ea14d87c864ede8.
Report an issue: GitHub.