Skip to content

fix: guard against JsonNull when parsing JSONRPC error field - #1

Open
RainYuY wants to merge 3 commits into
mainfrom
RainYuY-patch-1
Open

RainYuY wants to merge 3 commits into
mainfrom
RainYuY-patch-1

Conversation

@RainYuY

@RainYuY RainYuY commented May 7, 2026

Copy link
Copy Markdown
Owner

Description

Root Cause

The serializer and deserializer are inconsistent:

  • A2AErrorTypeAdapter.write() emits "error": null for null errors
  • parseResponseBody() assumes the key's presence implies a non-null object

The correct long-term fix is to also stop emitting "error": null in
A2AErrorTypeAdapter.write(), but this client-side guard is sufficient to
prevent the crash.

Impact

Without this fix, every non-streaming A2A call fails with ClassCastException
regardless of whether the response is actually an error.


Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests pass
  • Appropriate READMEs were updated (if necessary)

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.

1 participant