✗ WRONG

tanstack-ai 1.4.0

stream.error-midstream · gemini

Back to results · Scenario

Requirements

IdLevelStatusEvidence
error-reportedMUSTCONTRADICTEDoutcome=returned; error.category=null; finish.value=null (absent); truth.finish="error"

What the provider sent

Finish
error
Raw finish
null
Text
Octop
Tool calls
[]
Usage
{
  "alternatives": {},
  "cached_input": null,
  "input": 22,
  "output": 2,
  "raw": {
    "candidatesTokenCount": 2,
    "promptTokenCount": 22,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 22
      }
    ],
    "serviceTier": "standard",
    "totalTokenCount": 24
  },
  "reasoning": null,
  "total": 24
}
Stream completed
false
Error
Message
This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.
Status
null
Type
UNAVAILABLE
Code
503
Wire excerpt
status: 200
content-type: text/event-stream
body (sse):
data: {"candidates": [{"content": {"parts": [{"text": "Octop"}],"role": "model"},"index": 0}],"usageMetadata": {"promptTokenCount": 22,"candidatesTokenCount": 2,"totalTokenCount": 24,"promptTokensDetails": [{"modality": "TEXT","tokenCount": 22}],"serviceTier": "standard"},"modelVersion": "gemini-3.5-flash-lite","responseId": "pgTOaonbKMuV_uMPvK7d4AE"}


data: {"error":{"code":503,"message":"This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.","status":"UNAVAILABLE"}}

What the library reported

Outcome
returned
Finish
{
  "raw": null,
  "source": null,
  "surface": "absent",
  "value": null
}
Text
Value
Octop
Surface
primary
Tool calls
[]
Usage
{
  "cached_input": null,
  "input": null,
  "output": null,
  "reasoning": null,
  "surface": {
    "cached_input": "absent",
    "input": "absent",
    "output": "absent",
    "reasoning": "absent",
    "total": "absent"
  },
  "total": null
}
Stream
{
  "chunks_seen": 3,
  "completed": null,
  "used": true
}
Error
null
Unsupported reason
null
Full observation JSON
{
  "elapsed_ms": 114.59352799999999,
  "error": null,
  "finish": {
    "raw": null,
    "source": null,
    "surface": "absent",
    "value": null
  },
  "format": "wiretruth.observation/v1",
  "library": {
    "api": "chat",
    "language": "javascript",
    "name": "tanstack-ai",
    "version": "1.4.0"
  },
  "notes": [],
  "outcome": "returned",
  "stream": {
    "chunks_seen": 3,
    "completed": null,
    "used": true
  },
  "structured": {
    "attempted": false,
    "returned_as_success": false,
    "value": null
  },
  "text": {
    "surface": "primary",
    "value": "Octop"
  },
  "tool_calls": [],
  "unsupported_reason": null,
  "usage": {
    "cached_input": null,
    "input": null,
    "output": null,
    "reasoning": null,
    "surface": {
      "cached_input": "absent",
      "input": "absent",
      "output": "absent",
      "reasoning": "absent",
      "total": "absent"
    },
    "total": null
  }
}

Fixture

derived gemini/stream.error-midstream

ProvenanceValue
Transforminject_error_event
Source fixturegemini/truncation.text-stream
RationaleThe provider reports an error after starting a successful HTTP stream.
Evidencehttps://github.com/googleapis/python-genai/blob/main/google/genai/_api_client.py

Reproduce

wiretruth serve gemini/stream.error-midstream

Plain-library snippet from the shim manifest.

createGeminiChat(model, apiKey, { baseURL: WIRETRUTH_BASE_URL_GEMINI }); SDK appends /v1beta/models/<model>:streamGenerateContent or :generateContent.

Upstream

confirmed Issue · PR

Fixed in: not specified

The cause is in @google/genai, which @tanstack/ai-gemini streams through: processStreamResponse checks for an error object with JSON.parse on the raw network read, before the SSE data: prefix is removed, so an error event never matches; generateContentResponseFromMldev then drops the error field. chat() yields the partial text and ends with no RUN_ERROR or RUN_FINISHED. A bare JSON error body does throw ApiError. Google reproduced it on 2026-10-22 and opened #2094. The Gemini error-event fixture is derived (an error object injected into a recorded stream); no live mid-stream Gemini error has been observed.

History

VersionGrade
1.4.0✗ WRONG
1.0.0✗ WRONG
0.71.0✗ WRONG