Sometimes, when I use gemini 2.5 pro, for some chunks of the data (so same prompts, slightly different inputs) it returns an empty response.
Now, this has been a know issue regarding Prohibited content or max tokens reached. But in my case, the finish_reason is None:
print(answer.candidates[0]) PyDev console: starting. Candidate( content=Content( parts=[ Part( text='' ), ], role='model' ) ) print(answer.candidates[0].finish_reason,answer.candidates[0].finish_message) None None
That means that I’m paying for the input tokens completely normal and the request is valid, but Gemini is just lazy/has an API bug and I don’t get my results. Now, I can try messing with the input data a bit or the temperature/seed and retry, but I’m still paying for something I didn’t get. right now, for this feature, it happens about every 1/8 requests, at production scale that’s a lot of wasted money.
print(f'Candidate Tokens Count: {answer.usage_metadata.candidates_token_count}', ' -- ', f'\nInput Tokens Count: {answer.usage_metadata.prompt_token_count}') Candidate Tokens Count: None -- Input Tokens Count: 21844
1 Like
Hello,
Do you notice this issue only with complex tasks, or does it also occur with simple prompts?
I started having the exact same:
{ “generations”: [ [ { “generationInfo”: { “finishReason”: “STOP”, “index”: 0 }, “message”: { “id”: [ “langchain_core”, “messages”, “AIMessageChunk” ], “kwargs”: { “additional_kwargs”: {}, “content”: , “id”: “run-48331704-214d-4461-9bff-351efe20be9d”, “invalid_tool_calls”: , “name”: “model”, “response_metadata”: { “finishReason”: “STOP”, “index”: 0 }, “tool_call_chunks”: , “tool_calls”: , “usage_metadata”: { “input_tokens”: 36999, “output_tokens”: 0, “total_tokens”: 37048 } }, “lc”: 1, “type”: “constructor” }, “text”: “” } ] ], “llmOutput”: { “tokenUsage”: { “completionTokens”: 0, “promptTokens”: 36999, “totalTokens”: 37048 } } }
0 output tokens, and just STOP
Hello,
We have raised your issue to the concerned team. Thank you for your patience.
both, mostly with complex, but if Gemini is unable to answer a query, it should say so, not have the API act as is everything’s fine and also bill me.
GV_Zap August 20, 2025, 6:06am 11 From Monday, everyday the issue starts at 11.30am-12pm IST, and lasts until late night 9pm. Again it started today.
Thanks, now it’s just happening more and more also on 2.5 lite. These are production services and supposed to be production ready models. We can’t have that happening