Skip to content

bug(ai): Error sending prompt to AI: TypeError: Cannot read properties of undefined (reading 'some') #9125

Open
@anisabboud

Description

@anisabboud

Operating System

Windows

Environment (if applicable)

Chrome

Firebase SDK Version

11.9.1

Firebase SDK Product(s)

AI

Project Tooling

Angular

Detailed Problem Description

I ran into this error once when sending a request to Gemini 2.5 Pro via generateContentStream:

Error sending prompt to AI: TypeError: Cannot read properties of undefined (reading 'some')

Image

candidate.content?.parts.some(

Perhaps candidate.content?.parts.some( should be candidate.content?.parts?.some(.

Steps and code to reproduce issue

Most requests don't seem to run into this issue, but one request did.

Replacing parts.some with parts?.some in googleai-mappers.ts should resolve the issue.

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