Repository navigation
fix(errordetails): handle nil Value in Typed.MarshalJSON - #474
Merged
yarolegovich merged 1 commit intoOct 19, 2026
Merged
Conversation
yarolegovich
approved these changes
Oct 19, 2026
nahapetyan-serob
pushed a commit
that referenced
this pull request
Oct 21, 2026
🤖 I have created a release *beep* *boop* --- ## [2.7.0](v2.6.0...v2.7.0) (2026-10-21) ### Features * add input mode validation ([#456](#456)) ([8c814be](8c814be)) * extension point for snapshot materialization logic ([#449](#449)) ([4899045](4899045)) * reject requests with unsupported A2A-Version ([#457](#457)) ([4226e74](4226e74)) * use application/a2a+json with Accept-based negotiation ([#465](#465)) ([a8caf47](a8caf47)) ### Bug Fixes * **a2a:** serialize task status timestamps in UTC ([#452](#452)) ([b657f33](b657f33)) * decode application/a2a+json error responses in the REST client ([#448](#448)) ([3e1aa7f](3e1aa7f)) * **errordetails:** handle nil Value in Typed.MarshalJSON ([#474](#474)) ([73c49ac](73c49ac)) * **grpc:** forward next_page_token in push config list responses ([#455](#455)) ([7210014](7210014)) * **grpc:** keep caller metadata when attaching service params ([#476](#476)) ([f01e895](f01e895)) * honor a2a+json Content Type when Accept is */* or missing ([#468](#468)) ([2169266](2169266)) * reject trailing data after the JSON body ([#453](#453)) ([e85760e](e85760e)) * **rest:** map non-A2A HTTP error responses by status code ([#471](#471)) ([4baba5f](4baba5f)) * return plain error when streaming fails before the first event ([#463](#463)) ([cf62533](cf62533)) * **taskstate:** reject unknown task state values on unmarshal and REST status param ([#404](#404)) ([534a60f](534a60f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #473 🦕
Motivation
Typed.MarshalJSONclonesw.Valuewithmaps.Cloneand then assigns@type. WhenValueis nil, which the public constructors allow (NewTyped(url, nil),NewFromStruct(nil)), the clone is nil and the assignment panics withassignment to entry in nil map.This is reachable from the server error path: if a handler returns an
*a2a.Errorcarrying such a detail, the JSON-RPC server panics inToJSONRPCError(internal/jsonrpc/jsonrpc.go) while marshaling the error data, instead of sending an error response.Changes
errordetails/errordetails.goMarshalJSONallocates the output map withmakeand copiesValueinto it withmaps.Copy. A nilValuenow marshals like an empty one ({"@type": ...}), and the caller's map is still never mutated.Tests
errordetails/errordetails_test.goTestTyped_MarshalJSON_NilValue— 2 subtests:NewTyped(ErrorInfoType, nil)andNewFromStruct(nil)marshal to{"@type": ...}without panicking.The new test panics on
mainand passes with the fix. Existing tests (TestErrorDetailsJSONCodec, including its immutability check) pass unchanged.Happy to adjust the approach!