{"record":{"id":"f5dacf8b882f888d","repo":"n8n-io/n8n","slug":"the-text-parameter-is-empty-f5dacf","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/PlanAndExecuteAgent/execute.ts","lineNumber":78,"sourceCode":"\t}\n\n\tconst items = this.getInputData();\n\tfor (let itemIndex = 0; itemIndex < items.length; itemIndex++) {\n\t\ttry {\n\t\t\tlet input;\n\t\t\tif (this.getNode().typeVersion <= 1.2) {\n\t\t\t\tinput = this.getNodeParameter('text', itemIndex) as string;\n\t\t\t} else {\n\t\t\t\tinput = 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}\n\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\tif (prompt) {\n\t\t\t\tinput = (await prompt.invoke({ input })).value;\n\t\t\t}\n\n\t\t\tconst response = await agentExecutor\n\t\t\t\t.withConfig(tracingConfig)\n\t\t\t\t.invoke({ input, outputParser });\n\n\t\t\tif (outputParser) {\n\t\t\t\tresponse.output = await extractParsedOutput(this, outputParser, response.output as string);\n\t\t\t}\n\n\t\t\treturnData.push({ json: response });\n\t\t} catch (error) {\n\t\t\tthrowIfToolSchema(this, error);\n\t\t\tif (this.continueOnFail()) {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/PlanAndExecuteAgent/execute.ts#L60-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the Agent node and verify the 'text' / prompt field has a non-empty value or a resolvable expression.","Upgrade the Agent node to the latest typeVersion so the more descriptive 'No prompt specified' error from getPromptInputByType surfaces instead.","If using an expression, confirm the upstream node outputs the referenced key (e.g. $json.chatInput for auto prompt type)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before invoking the agent, ensure the prompt resolves to a non-empty string\nconst raw = this.getNodeParameter('text', itemIndex, '') as string;\nif (!raw || raw.trim() === '') {\n  throw new NodeOperationError(this.getNode(), 'Prompt is empty — please provide input text.');\n}","typeGuard":"function hasPrompt(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0;\n}","tryCatchPattern":"try {\n  input = getPromptInputByType({ ctx: this, i: itemIndex, inputKey: 'text', promptTypeKey: 'promptType' });\n} catch (e) {\n  // Surface a user-facing error with the itemIndex context\n  throw new NodeOperationError(this.getNode(), 'Prompt could not be resolved for this item', { itemIndex, cause: e });\n}","preventionTips":["Always set a default or example value in the 'text' parameter when authoring the workflow.","If using an expression, validate the upstream field exists in the executions view before enabling production.","Upgrade Plan & Execute Agent to the latest typeVersion so the helper's descriptive error surfaces."],"tags":["langchain","agent","prompt","configuration","plan-and-execute"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}