Skip to content

Failed Interactions API calls always report UNKNOWN_ERROR / "Unknown error" #7882

Closed

Description

@adityasingh2400

🔴 Required Information

Describe the Bug:
With Gemini(use_interactions_api=True), every failed interaction comes back as error_code="UNKNOWN_ERROR" and error_message="Unknown error". The real error, such as RESOURCE_EXHAUSTED: Quota exceeded…, never reaches the caller, so retries, on_model_error_callback and logs can't tell a quota error from a bad request.

convert_interaction_to_llm_response reads interaction.error, but no google-genai Interaction declares an error field. The API puts failures in errors: list[Error(code, message)]. On a completed SSE event, the partial InteractionSseEventInteraction keeps the same undeclared errors as raw dicts. So getattr(interaction, 'error', None) is always None, and the defaults win. This affects non-streaming calls, deferred-tier polling and streaming.

build_interactions_response_log reads the same missing field, so the debug log of a failed interaction always shows Error: (none).

The existing test_failed_response doesn't catch this, because it sets interaction.error = MagicMock(...) by hand.

Steps to Reproduce:

  1. Use Gemini(model="gemini-3-flash-preview", use_interactions_api=True).
  2. Have the API return a failed interaction, e.g. {"id": "int-9", "status": "failed", "errors": [{"code": "RESOURCE_EXHAUSTED", "message": "Quota exceeded for model gemini-3-flash-preview"}]}.

Expected Behavior:
LlmResponse.error_code == "RESOURCE_EXHAUSTED" and error_message == "Quota exceeded for model gemini-3-flash-preview".

Observed Behavior:
With a real google-genai client (2.34.0) and an httpx.MockTransport returning the payload above:

non_streaming  -> error_code='UNKNOWN_ERROR' error_message='Unknown error'
deferred       -> error_code='UNKNOWN_ERROR' error_message='Unknown error'
streaming      -> error_code='UNKNOWN_ERROR' error_message='Unknown error'

Environment Details:

  • ADK Library Version (pip show google-adk): 2.13.0 (also on main at e9e8f61)
  • Desktop OS: macOS
  • Python Version (python -V): 3.11.16

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: Gemini (gemini-3-flash-preview) through the Interactions API

🟡 Optional Information

Minimal Reproduction Code:

from google.adk.models import interactions_utils
from google.genai.interactions import Error, Interaction

interaction = Interaction(
    id="int-9",
    status="failed",
    errors=[Error(code="RESOURCE_EXHAUSTED", message="Quota exceeded")],
)
r = interactions_utils.convert_interaction_to_llm_response(interaction)
print(r.error_code, r.error_message)  # UNKNOWN_ERROR Unknown error

How often has this issue occurred?:

  • Always (100%), for every failed interaction

Activity

  1. adityasingh2400 commented on Nov 3, 2026

    @adityasingh2400
    ContributorAuthor

    1a5a36d, which landed on main on 11-02, fixes this for non-streaming and polled calls. convert_interaction_to_llm_response and build_interactions_response_log now read interaction.errors. On main, the repro above now returns RESOURCE_EXHAUSTED / Quota exceeded, and the response log shows the error.

    The streaming line in the report came from a mocked interaction.completed event that carried errors. The SDK's InteractionSseEventInteraction doesn't declare that field, and a streamed failure arrives as an error event, which ADK already reads. So nothing from this issue is left. I'm closing #7883 as superseded, and closing this issue as fixed by 1a5a36d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions