Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Gemini Live API frequently Closes with "Requested entity was not found" #487

@SalamanderXing

Description

@SalamanderXing

Description of the bug:

When sending tool responses via sendToolResponse(), the Gemini Live API WebSocket closes with either code 1011 ("Internal error occurred") or code 1008 ("Requested entity was not found"). This happens randomly after tool calls return responses, not consistently.

The error messages are unhelpful. They don't indicate whether the issue is payload size, format, encoding, invalid tool call IDs, or something else, which makes debugging difficult.
I tried making sure tool ids are correct and shortening system prompts and tool responses but issue persists.

Actual vs expected behavior:

Actual:

  • Tool executes successfully
  • Tool response is sanitized and formatted
  • We call sendToolResponse({ functionResponses })
  • WebSocket closes immediately with code 1011 ("Internal error occurred") or code 1008 ("Requested entity was not found")
  • No additional error details provided
  • This happens randomly, not deterministically

Expected:

  • Tool response is accepted and processed, OR
  • If rejected, a clear error message explaining why (e.g., "Response too large", "Invalid format", "Encoding error", "Tool call ID not found", etc.)

Any other information you'd like to share?

  • Model: gemini-2.5-flash-native-audio-preview-09-2025
  • Session config includes responseModalities: [Modality.AUDIO] and outputAudioTranscription: {}
  • Tools are provided as an array of objects with functionDeclarations

Tool response format:
We send responses in this structure:

{
  functionResponses: [
    {
      id: "uuid-string",
      name: "tool-name",
      response: {
        output: "string-response-content"  // Plain string, not JSON
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions