{"record":{"id":"3ea14d87c864ede8","repo":"n8n-io/n8n","slug":"the-text-parameter-is-empty-3ea14d","errorCode":null,"errorMessage":"The \"text\" parameter is empty.","messagePattern":"The \"text\" parameter is empty\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/prepareItemContext.ts","lineNumber":56,"sourceCode":" * @param response - Optional engine response with previous tool calls\n * @returns ItemContext containing all item-specific state\n */\nexport async function prepareItemContext(\n\tctx: IExecuteFunctions | ISupplyDataFunctions,\n\titemIndex: number,\n\tresponse?: EngineResponse<RequestResponseMetadata>,\n\tmodel?: BaseChatModel,\n): Promise<ItemContext> {\n\tconst steps = buildSteps(response, itemIndex);\n\n\tconst input = getPromptInputByType({\n\t\tctx,\n\t\ti: itemIndex,\n\t\tinputKey: 'text',\n\t\tpromptTypeKey: 'promptType',\n\t});\n\tif (input === undefined) {\n\t\tthrow new NodeOperationError(ctx.getNode(), 'The \"text\" parameter is empty.');\n\t}\n\n\tconst outputParser = await getOptionalOutputParser(ctx, itemIndex);\n\tconst tools = await getTools(ctx, outputParser);\n\tconst options = ctx.getNodeParameter('options', itemIndex) as AgentOptions;\n\n\tif (options.enableStreaming === undefined) {\n\t\toptions.enableStreaming = true;\n\t}\n\n\t// Prepare the prompt messages and prompt template.\n\tconst messages = await prepareMessages(ctx, itemIndex, {\n\t\tsystemMessage: options.systemMessage,\n\t\tpassthroughBinaryImages: options.passthroughBinaryImages ?? true,\n\t\tpassthroughBinaryPdfs: options.passthroughBinaryPdfs ?? false,\n\t\toutputParser,\n\t\tmodel,\n\t});","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/prepareItemContext.ts#L38-L74","documentation":"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.","triggerScenarios":"Empty prompt for the item (theoretically). The helper's own error fires first in practice.","commonSituations":"Stock n8n: should not occur. Forked helper returning undefined: possible.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const input = getPromptInputByType({ ctx, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });\nif (input === undefined || (typeof input === 'string' && input.trim() === '')) {\n  throw new NodeOperationError(ctx.getNode(), `Tools Agent prompt is empty for item ${itemIndex}.`);\n}","typeGuard":"function hasPrompt(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Ensure every item has a non-empty prompt.","Validate upstream output fields used by expressions."],"tags":["langchain","agent","tools-agent","prompt","dead-code","v3"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}