UI overlay breaks when Vertex AI returns truncated JSON responses #4868

Open
opened 2026-02-16 17:45:56 -05:00 by yindo · 0 comments
Owner

Originally created by @Skeptomenos on GitHub (Jan 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When using OpenCode heavily with Vertex AI Flash models, the UI breaks with an error overlay showing:

SyntaxError: Unexpected end of JSON input
at <parse> (native)
at json (unknown)
at <anonymous> (../sdk/js/src/v2/gen/client/client.gen.ts:167:33)

Environment

  • Provider: Vertex AI (Flash models)
  • Usage pattern: Heavy/concurrent usage

Root Cause Analysis

The error occurs at client.gen.ts:167 when response.json() is called on a truncated response body. This happens when:

  • Network connection drops mid-response
  • Vertex AI times out or rate-limits under load
  • Multiple concurrent requests strain the connection

While error handling exists in the SDK (lines 169-198), the error still surfaces to the UI and breaks the interface with an overlay.

Expected Behavior

Transient JSON parse errors from provider responses should be caught and retried gracefully without breaking the UI overlay.

Actual Behavior

Error overlay appears, blocking the UI and requiring manual dismissal or restart.

Screenshot

Error Screenshot

Suggested Fix

Consider catching SyntaxError specifically in the streaming/response handling layer and treating truncated JSON as a retryable error rather than surfacing it to the UI.

Originally created by @Skeptomenos on GitHub (Jan 12, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description When using OpenCode heavily with Vertex AI Flash models, the UI breaks with an error overlay showing: ``` SyntaxError: Unexpected end of JSON input at <parse> (native) at json (unknown) at <anonymous> (../sdk/js/src/v2/gen/client/client.gen.ts:167:33) ``` ## Environment - Provider: Vertex AI (Flash models) - Usage pattern: Heavy/concurrent usage ## Root Cause Analysis The error occurs at `client.gen.ts:167` when `response.json()` is called on a truncated response body. This happens when: - Network connection drops mid-response - Vertex AI times out or rate-limits under load - Multiple concurrent requests strain the connection While error handling exists in the SDK (lines 169-198), the error still surfaces to the UI and breaks the interface with an overlay. ## Expected Behavior Transient JSON parse errors from provider responses should be caught and retried gracefully without breaking the UI overlay. ## Actual Behavior Error overlay appears, blocking the UI and requiring manual dismissal or restart. ## Screenshot ![Error Screenshot](https://github.com/user-attachments/assets/error-overlay.png) ## Suggested Fix Consider catching `SyntaxError` specifically in the streaming/response handling layer and treating truncated JSON as a retryable error rather than surfacing it to the UI.
yindo added the zen label 2026-02-16 17:45:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4868