Input values have 3 keys, you must specify an input key or pass only 1 key as input

Describe the problem/error/question

When attempting to use any memory with an AI agent, getting error that input values have too many keys:

“input values have 3 keys, you must specify an input key or pass only 1 key as input”

What is the error message (if any)?

“input values have 3 keys, you must specify an input key or pass only 1 key as input”

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: [email protected]
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Sanoma 14.7.1
3 Likes

i have this exact same problem all of a sudden

Hi, I have this exact same problem all of a sudden

1 Like

Hi, I have this exact same problem all of a sudden

It seems this is a new problem/bug maybe? I am getting this when even using Postgres as memory I get the same error as well.

1 Like

I’m getting this problem too. Updated to the latest version, recreated the entire workflow from scratch. I’m far from an expert with any of this, I really truly do not know whether I’ve screwed something up somewhere along the line, whether there’s an error/bug that’s just not possible to get around currently, or whether or not there’s something missing entirely from the workflow.

Check you have a primary field specified with [[ ]] rather than {{ }}. The other thing I had going was the Parent agent sending null and empty data. Corrected that with the images attached. But the actual input error was just specifying the primary key with [[ ]].



1 Like

I also have this problem. I used {{}} so that was ok. Anybody solve this?

OK so I looked at it with a group of people in a support call yesterday and couldn’t find anything wrong with the flow in my case. I swapped around memory also without any succes. It looks like a bug in the Tools Agent. I was able to work around it by calling a part of my code in a separate flow.

1 Like

Same here. Seems the agent is sending [null] in both Input and Output structures. Supposedly it should have some data.

Please try upgrading to 1.81.4
Some bugs were fixed

@Spaasz @pranicvivek @Keith_Cheung @raggyp @penguin @HamChowderr

I have the same problem, and I’m on the latest version 1.82.3.

1 Like

Good afternoon,

I installed my n8n server yesterday and I have the same problem when I use an AI Agent (tools agent) Node with telegram trigger. When I use a chatbot trigger no problem.

I try to connect Xata, PostgresSql in local, Redis and always the same problem.

I see that the memory is called 2 times before and after model call. And It fail at the second time.

First call Input (tool agent)

[
{
"action": 
"loadMemoryVariables",
"values": 
{
"input": 
"",
"system_message": 
"You are an intelligent assistant.\nFor any requests related to emails, use the 'mail agent'.\nFor retrieving contact information or details about any contact, use the 'contact agent'.\nEnsure you select the appropriate tool based on the nature of the request.",
"formatting_instructions": 
"IMPORTANT: Always call `format_final_response` to format your final response!"
}
}
]

Seconde call input (Tool Agent)


[
{
"action": 
"saveContext",
"input": 
{
"input": 
"",
"system_message": 
"You are an intelligent assistant.\nFor any requests related to emails, use the 'mail agent'.\nFor retrieving contact information or details about any contact, use the 'contact agent'.\nEnsure you select the appropriate tool based on the nature of the request.",
"formatting_instructions": 
"IMPORTANT: Always call `format_final_response` to format your final response!"
},
"output": 
{
"input": 
"",
"system_message": 
"You are an intelligent assistant.\nFor any requests related to emails, use the 'mail agent'.\nFor retrieving contact information or details about any contact, use the 'contact agent'.\nEnsure you select the appropriate tool based on the nature of the request.",
"formatting_instructions": 
"IMPORTANT: Always call `format_final_response` to format your final response!",
"chat_history": 
[
],
"output": 
"Hello there! How can I assist you today?"
}
}
]

I’m currently having the exact same problem, very frustrating, has anyone managed to fix this?

1 Like

Hi @itc_uk , I think it could be a memory issue. I was able to work around it by putting some of my nodes in a subflow.

I was getting the exact same error. I noticed that if the chatInput input is empty or missing in the AI Agent, this error occurs.

1 Like

It worked with me without update to the last version, I got the same error, solve it by add set values node like example below:

But when I try on ur flow still not solved, even after updating to the last version.

Waiting N8N support team to check it.


If my answer rings a bell :bell: take a step, love it :heart: and let me know! But if it’s correct :+1:, please mark it as the accepted solution! Thanks a lot! :blush:

Let me know if you’d like any further tweaks! :rocket:

1 Like

@raggyp I was experiencing the same error. I noticed that I was sending an empty string in the “User Message” field. After I changed it to access the correct attribute and send the correct string, it worked again.

1 Like

I seem to have fixed this issue…with help of chat GPT…by changing the Postgres node session ID to ‘define below’. Then for my workflow I enetred ‘{{$json[“session_id”] || $json[“chat_id”] || “default-session”}}’. and that seemed to have fixed it!

I also have the same Issue, but in my case, Im doing a Whatsapp bot, the first iteration its good and the bot replies correctly, but for some reason, after that good iteration, the workflow inmediately run itself again and that error appears.