Describe the problem/error/question
Hi n8n team,
I’m encountering an issue when using Google AI models (such as PaLM or Gemini) in the AI Agent node.
When I include a system message
in the chat memory, I get the following error from the model:
[ERROR: System message should be the first one]
Expected:
The system message
should be accepted as long as it’s configured correctly in the chat memory.
What happens:
Even when the system message
is set properly, the model returns this error. It seems like the message is not being placed as the first item in the message array before being sent to the Google API.
Notes:
- This issue only affects Google AI models.
- According to Google’s documentation, the
system message
must be the first message in the array. - When using OpenAI models, the same configuration works fine and no error is thrown.
- It appears that a user message is being inserted before the system message, which causes the error.
Thanks in advance for your attention!
Let me know if you need more details or logs.
What is the error message (if any)?
[ERROR: System message should be the first one]
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: