{"record":{"id":"c5684e0bfeef465b","repo":"n8n-io/n8n","slug":"the-text-parameter-is-empty-c5684e","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/V2/execute.ts","lineNumber":315,"sourceCode":"\t\t\t);\n\t\t}\n\n\t\t// Check if streaming is enabled\n\t\tenableStreaming = this.getNodeParameter('options.enableStreaming', 0, true) as boolean;\n\n\t\tfor (let i = 0; i < items.length; i += batchSize) {\n\t\t\tconst batch = items.slice(i, i + batchSize);\n\t\t\tconst batchPromises = batch.map(async (_item, batchItemIndex) => {\n\t\t\t\tconst itemIndex = i + batchItemIndex;\n\n\t\t\t\tconst input = getPromptInputByType({\n\t\t\t\t\tctx: this,\n\t\t\t\t\ti: itemIndex,\n\t\t\t\t\tinputKey: 'text',\n\t\t\t\t\tpromptTypeKey: 'promptType',\n\t\t\t\t});\n\t\t\t\tif (input === undefined) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'The \"text\" parameter is empty.');\n\t\t\t\t}\n\t\t\t\tconst outputParser = await getOptionalOutputParser(this, itemIndex);\n\t\t\t\tconst tools = await getTools(this, outputParser);\n\t\t\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\t\t\tsystemMessage?: string;\n\t\t\t\t\tmaxIterations?: number;\n\t\t\t\t\treturnIntermediateSteps?: boolean;\n\t\t\t\t\tpassthroughBinaryImages?: boolean;\n\t\t\t\t\tpassthroughBinaryPdfs?: boolean;\n\t\t\t\t\ttracingMetadata?: { values?: Array<{ key: string; value: unknown }> };\n\t\t\t\t};\n\n\t\t\t\t// Prepare the prompt messages and prompt template.\n\t\t\t\tconst messages = await prepareMessages(this, itemIndex, {\n\t\t\t\t\tsystemMessage: options.systemMessage,\n\t\t\t\t\tpassthroughBinaryImages: options.passthroughBinaryImages ?? true,\n\t\t\t\t\tpassthroughBinaryPdfs: options.passthroughBinaryPdfs ?? false,\n\t\t\t\t\toutputParser,","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts#L297-L333","documentation":"Thrown per-item inside Tools Agent V2's batch loop when getPromptInputByType returns undefined for that item's prompt. Same caveat as 648: the helper throws its own 'No prompt specified' before returning undefined, so this exact message is effectively unreachable in stock code.","triggerScenarios":"An item in the batch has an empty prompt (theoretically). In practice the helper throws first.","commonSituations":"Same as 648 — should not surface in stock n8n; possible only with a forked helper that returns undefined.","solutions":["Populate the prompt parameter for every item in the batch.","Upgrade to Tools Agent V3.","If running a fork, ensure the helper throws on undefined."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const input = getPromptInputByType({ ctx: this, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });\nif (input === undefined || (typeof input === 'string' && input.trim() === '')) {\n  throw new NodeOperationError(this.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 in the batch has a non-empty prompt.","Upgrade to V3."],"tags":["langchain","agent","tools-agent","prompt","dead-code","v2"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}