Structured outputs just suddenly started failing

In the last hour, the gemini api suddenly started failing every single time, after succeeding for weeks with the same prompt.

I am using the openai api per the docs for getting structured output.

model: gemini-2.5-pro-exp-03-25

I get the error back: Error generating structured output, primary retry #2: SyntaxError: Unexpected token ‘y’, "ny ```json "… is not valid JSON

So it is suddenly never returning valid json, when using the structured output API as described in the documentation.

This only happens with this model. Flash and others are working fine (with the exact same prompt and schema).

Why did this one suddenly change?

2 Likes

Hey @Dark_Violet , You are right, there seems to be an issue with the 2.5-pro model. Thanks for escalating the issue, I will check with the team on this.

2 Likes

Longer thread here: Gemini 2.5 Pro inserting random text and format tokens around json responses

This has been going on for at least a day or two. Really big bug and causing a lot of people (including us) to move to other models

3 Likes

Yep, had to move everything off of this model. But this was the best and I really need it for a product demo!!
Thanks!

This is no longer happening as of this afternoon. Thank you!