Skip to content

AI: Failed to parse stream (AI/parse-failed) #9362

@tejasvi

Description

@tejasvi

Operating System

macOS

Environment (if applicable)

Chrome

Firebase SDK Version

12

Firebase SDK Product(s)

AI

Project Tooling

Expo with Firebase web js.

Detailed Problem Description

I am giving the model a prompt which is expected to generate a very long response. I have tried non-streaming and streaming mode and the failure occurs exactly after 3 minutes. Firebase transactions have 3 minute timeout but I am not using them. I have set the timeout to 20 minutes for the model.

In non-streaming mode the request failed with 502 error and in streaming mode I stop getting new Eventstream messages and a FirebaseError: AI: Failed to parse stream (AI/parse-failed).

Steps and code to reproduce issue

Prompt: prompt.txt

export const SCHEMA = Schema.object({
  properties: {
    reasoning: Schema.string(),
    qualia: Schema.string(),
  },
  propertyOrdering: ["reasoning", "qualia"],
  optionalProperties: ["reasoning"],
});
responseMimeType: "application/json"

Gemini 2.5 pro, thinking budget 32728, safety: block none, timeout: 1200 * 1e3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions