[RESOLVED] 400 Invalid value for 'content': expected a string, got null" with AI Agent and Redis Chat Memory - Step-by-Step Solution

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:

  1. Remove the Problematic AI Agent:

    • I completely deleted the AI agent that was causing the error in my workflow.
  2. 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.
  3. 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 the content field.

  4. 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.

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!

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Welcome to the community @alif !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


Thanks for sharing your solution!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.