Skip to content

[Bug]gemini-2.5-flash-lite intermittently returns empty STOP response after function call #2667

Description

@k-symmons

Description

gemini-2.5-flash-lite intermittently returns an empty STOP response — content.parts=None, response.text=None, candidates_token_count=None — on the turn after function call results are sent back. When this happens consistently across iterations it causes agents to loop until they exhaust their iteration limit. gemini-2.5-flash does not exhibit this behaviour.

Reproduction

In a multi-turn agent loop using generate_content with a system_instruction and several registered tools, the second turn (after returning function results) consistently returns an empty response:

  1. Correctly generate a function_call on turn 1
  2. Receive the function result on turn 2
  3. Return Candidate(content=Content(parts=None, role='model'), finish_reason=STOP) — every time, across 10+ consecutive iterations
Prompt tokens: 576
Response tokens: None        # candidates_token_count is None
finish_reason: STOP
content.parts: None
response.text: None

The failure was 100% reproducible in the agent context but did not reproduce reliably in minimal isolation tests, suggesting it is sensitive to the full conversation context (system instruction length, tool count, accumulated message history, or model load).

Confirmed workaround

Switching model from gemini-2.5-flash-lite to gemini-2.5-flash resolves the issue completely.

Environment

  • google-genai version: 1.12.1
  • Python: 3.13
  • Failing model: gemini-2.5-flash-lite
  • Working model: gemini-2.5-flash

Related

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsetype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions