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:
- Correctly generate a
function_call on turn 1
- Receive the function result on turn 2
- 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
Description
gemini-2.5-flash-liteintermittently returns an emptySTOPresponse —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-flashdoes not exhibit this behaviour.Reproduction
In a multi-turn agent loop using
generate_contentwith asystem_instructionand several registered tools, the second turn (after returning function results) consistently returns an empty response:function_callon turn 1Candidate(content=Content(parts=None, role='model'), finish_reason=STOP)— every time, across 10+ consecutive iterationsThe 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
modelfromgemini-2.5-flash-litetogemini-2.5-flashresolves the issue completely.Environment
google-genaiversion: 1.12.1gemini-2.5-flash-litegemini-2.5-flashRelated
Geminiproviding empty responses withfinish_reason=STOPBerriAI/litellm#24442