Skip to content

Conversation

@seekskyworld
Copy link

@seekskyworld seekskyworld commented Jan 12, 2026

Issue link:

Summary:

  • Handle empty JSON responses by falling back to {} instead of throwing.
  • Apply the fix to v1/v2 generated clients and keep it via the SDK build patch.

Motivation:

  • Some endpoints can return empty bodies, which currently triggers Unexpected end of JSON input in the desktop app.

Validation:

  • bun run typecheck (packages/sdk/js)

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

PR #7888 - fix(sdk): handle empty JSON response bodies gracefully
#7888

Why it's related: This PR directly addresses the same issue - handling empty JSON response bodies in the SDK client. It appears to be a prior or related attempt to solve the same problem of empty responses causing JSON parsing errors.


Related PRs (may have overlapping fixes):

PR #7618 - fix(sdk): improve JSON parsing error handling with contextual messages
#7618

PR #7939 - fix: add error handling to RPC system to prevent crashes on session abort
#7939

These may have related error handling improvements in the JSON parsing pipeline that could conflict or overlap with your PR.

@seekskyworld
Copy link
Author

Linked the existing issue in the PR description (Fixes #8014).

@mrlubos
Copy link
Contributor

mrlubos commented Jan 13, 2026

@seekskyworld this will be fixed upstream hey-api/openapi-ts#3202

@seekskyworld
Copy link
Author

ok

@mrlubos
Copy link
Contributor

mrlubos commented Jan 17, 2026

@seekskyworld the JSON issue was fixed in v1.1.24, can you try and let me know if this pull request is still needed?

@seekskyworld
Copy link
Author

@mrlubos Thanks! I checked v1.1.24 and the v2 SDK now handles empty JSON responses (reads response.text() and parses only
when non‑empty). The issue no longer repros for v2, so this PR seems unnecessary; happy to close unless you still
want coverage for the v1 SDK.

@mrlubos
Copy link
Contributor

mrlubos commented Jan 17, 2026

@seekskyworld while it would be nice, I assume they don't maintain v1 anymore as I can't see the build script for it. Let me know if you run into any other issues with OpenCode SDKs! I work on the tooling behind them, so this bug is on me

@seekskyworld
Copy link
Author

@mrlubos Thanks, that makes sense! I’ll close this PR. I do have a few other PRs that have been waiting for review—could you
take a look when you have a chance and let me know if anything is blocking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Unexpected end of JSON input

2 participants