AI agent failed with NodeOperationError: No prompt specified at getPromptInputByType

Describe the problem/error/question

AI agent returns error of No prompt specified, but I do define the prompt and the Human Input is same as the referenced node value, then why there is no prompt specified?

What is the error message (if any)?

Node type: @n8n/n8n-nodes-langchain.agent

Node version: 3.1 (Latest)

n8n version: 2.1.5 (Self Hosted)

Time: 6/1/2026, 4:05:56 AM

Stack trace

NodeOperationError: No prompt specified at getPromptInputByType (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/utils/helpers.ts:96:9) at prepareItemContext (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/prepareItemContext.ts:43:16) at /Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/executeBatch.ts:60:29 at Array.map (<anonymous>) at executeBatch (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/executeBatch.ts:55:30) at ExecuteContext.toolsAgentExecute (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V3/execute.ts:46:72) at ExecuteContext.execute (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/V3/AgentV3.node.ts:139:10) at WorkflowExecute.executeNode (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1045:8) at WorkflowExecute.runNode (/Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1226:11) at /Users/Tech/software/node-v22.18.0-darwin-arm64/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1662:27

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.1.5
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: MacOS

@257011908 In your image it’s because your node is looking for .json in the input box. Just drag the input from the arrow below in the image below to the user message and it should work!

Hi @achamm,

I dragged, it still show undefined.

What fixes for me sometimes is put a set node inbetween the telegram and the ai, drag the text input var to the set node, than use set node for the ai agent part

yea the .item ref breaks when ur chain filters stuff upstream. set node between trigger and agent fixes it:

drop in the set node, name the field message and set value to ur telegram text expression, then the agent reads $json.message from its immediate input — always exists no matter what filtered upstream

Is it because I have more than 1 AI agent nodes in the workflow, because the top one for admin user is working.

yea multiple is fine. ur failing one (register user) IS already on Define below same as the admin one — the difference is just where it sits in the chain. when the register branch fires after a few filter/route nodes, $(‘Telegram Trigger’).item resolves to undefined because the item index doesnt match across branches anymore. thats why the resolved value at the bottom of the prompt field shows “undefined” in ur screenshot.

set node right before the failing agent fixes it like i said — it captures the telegram text into $json.message which always exists on the immediate input regardless of branching. n8n docs on this error: AI Agent node common issues | n8n Docs

@achamm

I followed your suggest and added a “Edit Field” in front of the agent and it is working.

But interestingly I did not update the prompt to $json.message and it is still working.

Thank you for your quick reply and suggestion, now I have fixed the issue.

Your welcome! Happy to help!