Bug: Gemini 3.1 Pro Preview Customtools dumps system prompt/training examples instead of responding

When using gemini-3.1-pro-preview-customtools via the Cloud Code API (cloudcode-pa.googleapis.com), the model outputs its entire system prompt and training examples verbatim instead of generating an actual response to the user’s message.

Input: A simple “hello world” message.

Expected behavior: The model responds with a normal greeting or acknowledgment.

Actual behavior: Instead of responding, the model dumped thousands of tokens containing:

  • XML-formatted tool usage examples (e.g., user: “Change the background color…”)
  • Internal reasoning instruction patterns (e.g., First I should use the glob tool…)
  • Full mock conversations showing how tools like bash, edit, glob, grep should be used
  • Code snippets from training examples (React components, Python scripts, Docker commands, etc.)

The output appeared to be the model’s internal system prompt or few-shot training examples being echoed back as the response rather than being treated as instructions.

Environment:

Notes:

  • This appears related to the Gemini 3.1 Pro leaking raw thought blocks ( [Bug] Gemini 3.1 Pro leaking raw _thought blocks and stuck in infinite "Done" loop ) report, but affects the customtools variant specifically.
  • The standard gemini-3.1-pro-preview model was not tested in the same session, so unclear if it’s also affected.
  • The issue occurred on the first message of a conversation, not after extended multi-turn context.