{"record":{"id":"d6968517d407968a","repo":"n8n-io/n8n","slug":"the-text-parameter-is-empty-d69685","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/V1/execute.ts","lineNumber":56,"sourceCode":"\n\tconst returnData: INodeExecutionData[] = [];\n\tconst items = this.getInputData();\n\tconst outputParser = await getOptionalOutputParser(this);\n\tconst tools = await getTools(this, outputParser);\n\n\tfor (let itemIndex = 0; itemIndex < items.length; itemIndex++) {\n\t\ttry {\n\t\t\tconst model = (await getChatModel(this)) as BaseLanguageModel;\n\t\t\tconst memory = await getOptionalMemory(this);\n\n\t\t\tconst input = getPromptInputByType({\n\t\t\t\tctx: this,\n\t\t\t\ti: itemIndex,\n\t\t\t\tinputKey: 'text',\n\t\t\t\tpromptTypeKey: 'promptType',\n\t\t\t});\n\t\t\tif (input === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'The “text” parameter is empty.');\n\t\t\t}\n\n\t\t\tconst options = this.getNodeParameter('options', itemIndex, {}) as {\n\t\t\t\tsystemMessage?: string;\n\t\t\t\tmaxIterations?: number;\n\t\t\t\treturnIntermediateSteps?: boolean;\n\t\t\t\tpassthroughBinaryImages?: boolean;\n\t\t\t\tpassthroughBinaryPdfs?: boolean;\n\t\t\t\ttracingMetadata?: { values?: Array<{ key: string; value: unknown }> };\n\t\t\t};\n\n\t\t\t// Prepare the prompt messages and prompt template.\n\t\t\tconst messages = await prepareMessages(this, itemIndex, {\n\t\t\t\tsystemMessage: options.systemMessage,\n\t\t\t\tpassthroughBinaryImages: options.passthroughBinaryImages ?? true,\n\t\t\t\tpassthroughBinaryPdfs: options.passthroughBinaryPdfs ?? false,\n\t\t\t\toutputParser,\n\t\t\t});","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V1/execute.ts#L38-L74","documentation":"Thrown by Tools Agent V1 when getPromptInputByType returns undefined. In practice this line is unreachable: getPromptInputByType itself throws 'No prompt specified' (with a more helpful description) before returning undefined. If you see this exact message, you are on a code path where the helper returned undefined without throwing (should not happen in shipped code).","triggerScenarios":"Theoretically: an empty text parameter. In practice: the helper throws first, so this message indicates either a custom fork of the helper or an internal invariant violation.","commonSituations":"Should not occur in stock n8n; may appear if a forked getPromptInputByType was modified to return undefined instead of throwing.","solutions":["Treat as the generic empty-prompt case: populate the text parameter.","If you maintain a fork, ensure getPromptInputByType throws on undefined rather than returning it.","Upgrade to Tools Agent V2/V3 where this is handled centrally."],"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.');\n}","typeGuard":"function hasPrompt(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always populate the prompt parameter.","Upgrade to Tools Agent V2/V3."],"tags":["langchain","agent","tools-agent","prompt","dead-code"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}