Effect CommunityEC
Effect Community3w ago
5 replies
sbs

Error with Gemini Models: Missing Required `contents` Field

It seems like trying to call gemini models returns an error:

{"error":{"code":400,"message":"* GenerateContentRequest.contents: contents is not specified\n","status":"INVALID_ARGUMENT"}} (400 POST https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash:generateContent)


I used a sneaky overriden http client with a .mapRequestEffect to log requests as they go out and see that it sends

{
  "model": "gemini-3-flash",
  "systemInstruction": {
    "parts": [
      {
        "text": "<my prompt>"
      }
    ]
  },
  "contents": [],
  "generationConfig": {
    "responseMimeType": "application/json",
    "responseSchema": {
      // ...
    }
  }
}


Notably, contents is empty. The documentation for the gemini API states

contents[] object (Content)
Required. The content of the current conversation with the model.
For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
Was this page helpful?