Following up on my earlier post, which hasn’t received a response and has dropped off the main page. This is still happening several times a day in our production. We weren’t seeing this issue before using gemini-nano-banana-2.1.
The API returns finishReason: "MAX_TOKENS" with no output content, even though the reported token usage is substantially below our configured maxOutputTokens: 32768.
After sending the same exact image a second time with the same data it works fine. It seems to be a very transient error.
Here is a recent example:
{
"finishReason": "MAX_TOKENS",
"promptTokenCount": 3905,
"candidatesTokenCount": 456,
"thoughtsTokenCount": 2063,
"totalTokenCount": 6424,
"contentPartCount": 0,
"request": {
"model": "gemini-nano-banana-2.1",
"maxOutputTokens": 32768,
"thinkingConfig": {
"thinkingLevel": "HIGH"
},
"imageConfig": {
"imageSize": "2K",
"aspectRatio": "3:2"
},
"inputWidth": 3840,
"inputHeight": 2561,
"temperature": 0
}
}
The request section is our logged configuration summary; the finish reason and token counts come from the provider response.
In this example, the reported candidate and thinking tokens total only 2,519, yet generation ends with MAX_TOKENS and no image or text is available to the application.
Earlier failures had the same pattern:
| Input tokens | Candidate tokens | Thinking tokens | Total tokens | Returned content parts |
|---|---|---|---|---|
| 4,620 | 1,904 | 2,554 | 9,078 | 0 |
| 4,406 | 1,483 | 3,136 | 9,025 | 0 |
| 4,522 | 704 | 1,734 | 6,960 | 0 |
Those requests also used maxOutputTokens: 32768, thinkingLevel: "HIGH", and 2K image output, with a 4:3 aspect ratio.
Could someone clarify:
- Is this a known issue with this model?
- Does
MAX_TOKENSsometimes indicate an internal image-generation or thinking limit that is not reflected in the returned token counts? - Is
maxOutputTokens: 32768honored for this model’s image generation, or is a different effective limit applied? - Is there a recommended workaround—for example, a different thinking level—without significantly reducing editing quality?
- What additional diagnostics would help investigate this, and how should we provide a sample input and prompt privately?
These failures interrupt real customer edits, so any guidance would be appreciated. I can provide additional examples and capture any request identifiers or diagnostic fields you recommend.
Thank you!