Uh oh!
There was an error while loading. Please reload this page.
fix(tui): handle JSON parse error on double-escape abort - #7959
Conversation
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #7939: "fix: add error handling to RPC system to prevent crashes on session abort" Why it's related: This PR addresses the same underlying issue of handling errors during session abort to prevent crashes. Both PRs target the scenario where a session abort races with in-flight requests, though PR #7939 focuses on the RPC system while PR #7959 (current) targets the TUI prompt component specifically. |
88785d6 to
a29bca8CompareWhen aborting a session with double-escape, the abort races with the in-flight prompt request. If the response is incomplete or empty, the SDK's JSON parser throws "Unexpected end of JSON input". Adding .catch() silences this expected error during abort, matching the pattern used elsewhere for session.abort() calls. Fixesanomalyco#7946 Co-Authored-By: Claude <noreply@anthropic.com>
a29bca8 to
dda8368Comparemrlubos
commented
Jan 13, 2026
@zerone0x this will be handled upstream, not sure if your change is still relevant after that hey-api/hey-api#3202 |
f1ae801 to
08fa7f7CompareClosing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Summary
Fixes#7946
When aborting a session with double-escape (pressing Esc twice), the
session.abort()call races with the in-flightsession.prompt()request. If the server terminates the response mid-stream, the response body is incomplete or empty, causing the SDK's JSON parser to throwSyntaxError: Unexpected end of JSON input.Changes
.catch(() => {})to thesession.abort()call in the TUI prompt component to silently ignore expected errors during abortThis matches the existing pattern used in
routes/session/index.tsx:400andapp/src/pages/session.tsx:577for the same scenario.Test plan
bun run typecheckon the opencode package (passes)🤖 Generated with Claude Code