N8n workflow error

I am having trouble with my n8n workflow, especially when it connects to Supabase to get information. I’m getting an error message that says ‘contents.parts must not be empty’.

I am having trouble with my n8n workflow, especially when it connects to Supabase to get information. I’m getting an error message that says ‘contents.parts must not be empty’.

```

Bad request - please check your parameters

[GoogleGenerativeAI Error]: Error fetching from (https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:streamGenerateContent?alt=sse:) [400 Bad Request] * GenerateContentRequest.contents[4].parts: contents.parts must not be empty.
```

Can you help me figure out what’s wrong?

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the 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:
1 Like

@Hovec This issue is common and can be caused when the language model isn’t returning any messages. Sometimes this could be because the LangChain node is outdated, the API key is invalid, or the prompts are not well written.
Try updating the node, checking your API credentials, and testing different prompts to see if that fixes the problem.
Let me know your progress so far and mark t this as the solution if you find it helpful.

3 Likes

Make sure your HTTP node for the Gemini API has contents[4].parts filled (not empty).

1 Like
{
  "contents": [
    {
      "role": "user",
      "parts": [
        { "text": "Message 1" }
      ]
    },
    {
      "role": "user",
      "parts": [
        { "text": "Message 2" }
      ]
    },
    {
      "role": "user",
      "parts": [
        { "text": "Message 3" }
      ]
    },
    {
      "role": "user",
      "parts": [
        { "text": "Message 4" }
      ]
    },
    {
      "role": "user",
      "parts": [
        { "text": "Message 5 (this is contents[4].parts)" }
      ]
    }
  ]
}

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