You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UI overlay breaks when Vertex AI returns truncated JSON responses #7985
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
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.
@thdxr this error appears randomly, I could not identify a pattern yet. I use Opus 4.5 and Gemini 3 both hosted on Vertex, sometimes I switch models within sessions.
Will paste more information and screenshots the next time the error occurs.
UPDATE: I just realized, that my error might be local. I have a typescript tool, that seems to be the culprit. When I move it away from the project folder, opencode behaves as expected. Investigating further, which function could be an issue. Already ran into zod dependency issues last week, which I thought I had fixed.
UPDATE after recovery: For me it was completely local:
The rename_note.ts tool has been successfully repaired, verified, and restored to the vault.
Root Cause Analysis (RCA) Summary
* Duplicate Variable: The vaultRoot variable was declared twice, causing potential runtime instability.
* Missing Error Handling: Incomplete try-catch blocks led to silent failures or crashes when encountering inaccessible directories.
* Registration Logic: The tool was not registering because the vault's governance protocol requires a corresponding test file in .opencode/tests/ to be present and passing.
* Module Resolution: A minor ESM export issue in the test environment (missing .js extensions) was fixed to allow tests to run.
Ok, seems to be consistent. After compaction OpenCode (probably a Sisyphus feature) auto response with "Continue" when i stop afterwards the issue appears.
Activity
github-actions commentedon Jan 12, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
thdxr commentedon Jan 12, 2026
do you have a way to reproduce this? we need to figure out what server request this is failing for. answer might be in logs
Skeptomenos commentedon Jan 12, 2026
@thdxr this error appears randomly, I could not identify a pattern yet. I use Opus 4.5 and Gemini 3 both hosted on Vertex, sometimes I switch models within sessions.
Will paste more information and screenshots the next time the error occurs.
Skeptomenos commentedon Jan 13, 2026
Skeptomenos commentedon Jan 13, 2026
The session compacted and continued. I canceld and performed an /undo
a1danpryde commentedon Jan 13, 2026
Updated Post, incl. local resolution
UPDATE: I just realized, that my error might be local. I have a typescript tool, that seems to be the culprit. When I move it away from the project folder, opencode behaves as expected. Investigating further, which function could be an issue. Already ran into zod dependency issues last week, which I thought I had fixed.
UPDATE after recovery: For me it was completely local:
Original Post
Model Provider: openrouter.ai
Models tried: Gemini 3 Flash, Gemini 3 Pro, Deepseek 3.2
Tried 'opencode --log-level DEBUG --print-logs' but could only get INFO level in ~/.local/share/opencode/log/ , where I cannot find any anomalies.
In UI I get the same as @Skeptomenos - here for easier copy and paste
For me closing opencode, changing session, or creating a new one does not help. Is there a work around at the moment?
Skeptomenos commentedon Jan 13, 2026
Ok, seems to be consistent. After compaction OpenCode (probably a Sisyphus feature) auto response with "Continue" when i stop afterwards the issue appears.
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.