Problem Description:
Recently, I encountered the following error while using an AI Agent in n8n with Redis Chat Memory:
Error:
400 Invalid value for 'content': expected a string, got null
This error occurs when the content
field expected by the AI agent is null
or missing, preventing the proper processing of messages.
Step-by-Step Solution:
After several attempts, I managed to resolve the issue by following these steps:
-
Remove the Problematic AI Agent:
- I completely deleted the AI agent that was causing the error in my workflow.
-
Create a New AI Agent:
- I added the AI agent again from scratch, ensuring that the configuration was clean and free of old stored data.
-
Use Bret Trucha’s Recommendation:
-
I followed a tip shared by Bret Trucha in the community:
-
I added a new memory node, such as Window Buffer Memory, and updated the session key with an additional string to reset the memory.
-
Updated Session Key:
v2_{{ $node["Add Session ID"].json["sessionId"] }}
-
-
This ensured the memory was reset correctly, avoiding the
null
error in thecontent
field.
-
-
Test the Workflow:
- I ran the workflow again, and the error was gone! The
content
field was correctly populated, and the AI agent worked as expected.
- I ran the workflow again, and the error was gone! The
Final Notes:
If the issue persists, feel free to reach out to me on WhatsApp for free assistance to support the community: +55 27 98818-6497.
- It seems the issue was related to a corrupted or misconfigured memory. Resetting the memory and recreating the agent helped resolve the problem.
- If you encounter this error, I recommend trying these steps. It worked perfectly for me!
I hope this solution helps others in the n8n community facing the same issue. Good luck and happy workflow building!