Skip to content

Unexpected end of json #7715

Closed
Closed

Description

@Davincible

Description

Image

Seems like #7618 is the fix

Plugins

No response

OpenCode version

1.1.10

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jan 10, 2026

    @github-actions
    Contributor

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

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

  2. coleleavitt commented on Jan 12, 2026

    @coleleavitt
    Contributor

    I've submitted a fix for this in #7888.

    Root cause: The SDK's client.gen.ts only handles empty responses when status === 204 or Content-Length === "0". When the server returns an empty body with status 200 and no Content-Length header, response.json() throws "Unexpected end of JSON input".

    Fix:

    1. Read response as text first, only parse JSON if non-empty
    2. Added try-catch with contextual error messages
    3. Fixed server OPTIONS handler to return proper 204 status

    This is a more complete fix than #7618 - it prevents the crash entirely rather than just improving the error message.

  3. mrlubos commented on Jan 13, 2026

    @mrlubos
    Contributor

    @Davincible this should be handled upstream hey-api/hey-api#3202

  4. added a commit that references this issue on Jan 16, 2026
    927c494
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions