Skip to content

[BUG] Gemini 3.6 Flash returns 400 Bad Request ("Requests ending with a model turn are not supported") #1052

Description

@jezjones

When using the newly released gemini-3.6-flash model via the GCP Vertex AI provider on Zoo Code 3.72.0, all prompts instantly fail with a 400 Bad Request error.

The API rejects the payload because Zoo Code's current architecture injects a partial model turn at the end of the request history to prefill tool usage (Assistant Prefilling). According to Google's updated documentation, prefilling model turns is no longer supported for Gemini 3.6 Flash and all future releases.

To Reproduce

  1. Set the API Provider to GCP Vertex AI.
  2. Set the Model to gemini-3.6-flash.
  3. Submit any prompt to the agent.
  4. The request immediately fails with the following error.

Error Log

{"error":{"message":"{\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"Requests ending with a model turn are not supported.\",\n    \"status\": \"INVALID_ARGUMENT\"\n  }\n}\n","code":400,"status":"Bad Request"}}

Root Cause & API Changes
Google has fundamentally changed the Vertex AI API for Gemini 3.6 Flash and 3.5 Flash-Lite:

  • API requests ending with a non-empty model role turn are strictly disallowed and will return an HTTP 400 Error.
  • Google recommends migrating to use system_instruction or Native Structured Outputs instead of manually prefilling model turns to force JSON formatting or tool usage.
  • As an additional heads up for the developers, Google has also deprecated the temperature, top_p, and top_k sampling parameters for this model generation, and supplying them will also return a 400 error.

Temporary Workaround
Rolling the model back to gemini-3.5-flash works perfectly, as the older model architecture still supports Assistant Prefilling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions