Session becomes unusable after UnknownError: Failed to parse #1418

Closed
opened 2026-02-16 17:30:52 -05:00 by yindo · 9 comments
Owner

Originally created by @maddeye on GitHub (Aug 21, 2025).

Originally assigned to: @thdxr on GitHub.

At irregular intervals, I encounter the error shown below. When this happens:

  • opencode still runs, but the affected session becomes unusable.
  • Any further prompts sent to this session just repeat the same error.
  • Attempting to reopen the session after starting a new one also fails.

Error Log

failed to send message: POST
"http://127.0.0.1:55413/session/ses_73XXXX2aXffeDTHiXXTUpWNVvX/message": 400 Bad Request
{"name":"UnknownError","data":{"message":"SyntaxError: Failed to parse JSON"}}

Environment

  • Using: GitHub Copilot with Claude Sonnet 4
  • opencode version: v0.5.7
  • OS: Windows with git Bash

Steps to Reproduce

The issue appears sporadically and I haven’t found a deterministic reproduction path, but:

  1. Start a session.
  2. Interact with opencode for some time.
  3. At some point, the session fails with the above error.

Expected Behavior

The session should continue working without requiring a restart.

Actual Behavior

The session becomes permanently stuck, repeating the error until a new session is created. Old sessions cannot be reopened.

Additional Context

The error only occurs intermittently, but once triggered, it breaks the session workflow entirely.

Originally created by @maddeye on GitHub (Aug 21, 2025). Originally assigned to: @thdxr on GitHub. At irregular intervals, I encounter the error shown below. When this happens: - opencode still runs, but the affected session becomes unusable. - Any further prompts sent to this session just repeat the same error. - Attempting to reopen the session after starting a new one also fails. ## Error Log ```bash failed to send message: POST "http://127.0.0.1:55413/session/ses_73XXXX2aXffeDTHiXXTUpWNVvX/message": 400 Bad Request {"name":"UnknownError","data":{"message":"SyntaxError: Failed to parse JSON"}} ``` ## Environment - Using: GitHub Copilot with Claude Sonnet 4 - opencode version: v0.5.7 - OS: Windows with git Bash ## Steps to Reproduce The issue appears sporadically and I haven’t found a deterministic reproduction path, but: 1. Start a session. 2. Interact with opencode for some time. 3. At some point, the session fails with the above error. ## Expected Behavior The session should continue working without requiring a restart. ## Actual Behavior The session becomes permanently stuck, repeating the error until a new session is created. Old sessions cannot be reopened. ## Additional Context The error only occurs intermittently, but once triggered, it breaks the session workflow entirely.
yindo closed this issue 2026-02-16 17:30:52 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 21, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1743: TUI failed to send message with similar HTTP 400 Bad Request error pattern and session communication failures
  • #1561: Session becomes unusable and gets stuck indefinitely, requiring restart (same core symptom of session becoming permanently unusable)
  • #2002: JSON Parse error with the write tool - reports similar "JSON parsing failed" errors that could be related to the "Failed to parse JSON" error you're experiencing
  • #1895: Multiple message requests to same session causing response issues - demonstrates session-level message handling problems that could be related

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Aug 21, 2025): This issue might be a duplicate of existing issues. Please check: - #1743: TUI failed to send message with similar HTTP 400 Bad Request error pattern and session communication failures - #1561: Session becomes unusable and gets stuck indefinitely, requiring restart (same core symptom of session becoming permanently unusable) - #2002: JSON Parse error with the write tool - reports similar "JSON parsing failed" errors that could be related to the "Failed to parse JSON" error you're experiencing - #1895: Multiple message requests to same session causing response issues - demonstrates session-level message handling problems that could be related Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Aug 21, 2025):

Is there anything special with this session? is it super long or anything

@rekram1-node commented on GitHub (Aug 21, 2025): Is there anything special with this session? is it super long or anything
Author
Owner

@maddeye commented on GitHub (Aug 26, 2025):

It's not consistent.
Sometimes it only takes one or two prompts, and sometimes it took 10+.

Deleting the cache have some effect on it. But nothing consistent to report.

@maddeye commented on GitHub (Aug 26, 2025): It's not consistent. Sometimes it only takes one or two prompts, and sometimes it took 10+. Deleting the cache have some effect on it. But nothing consistent to report.
Author
Owner

@rekram1-node commented on GitHub (Sep 23, 2025):

Are you still encountering this on latest @maddeye

@rekram1-node commented on GitHub (Sep 23, 2025): Are you still encountering this on latest @maddeye
Author
Owner

@maddeye commented on GitHub (Sep 24, 2025):

Cannot test ot right now. I will chrck on monday.

@maddeye commented on GitHub (Sep 24, 2025): Cannot test ot right now. I will chrck on monday.
Author
Owner

@maddeye commented on GitHub (Sep 29, 2025):

The problem seems to be fixed. Thanks a lot!

@maddeye commented on GitHub (Sep 29, 2025): The problem seems to be fixed. Thanks a lot!
Author
Owner

@rekram1-node commented on GitHub (Sep 29, 2025):

awesome!

@rekram1-node commented on GitHub (Sep 29, 2025): awesome!
Author
Owner

@vanboom commented on GitHub (Dec 4, 2025):

Curious if there is a way to fix this to resume the session? It is happening to us today multiple times leaving a corrupted session that can't continue.

@vanboom commented on GitHub (Dec 4, 2025): Curious if there is a way to fix this to resume the session? It is happening to us today multiple times leaving a corrupted session that can't continue.
Author
Owner

@rekram1-node commented on GitHub (Dec 4, 2025):

@vanboom whats the error, provider, etc? Can you share the session

@rekram1-node commented on GitHub (Dec 4, 2025): @vanboom whats the error, provider, etc? Can you share the session
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1418