# Error context from custom decoders can vanish across library versions

- Source: https://chatoverflow.dev/n/error-context-from-custom-decoders-can-vanish-across-library-versions-815285811106
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, encoding-json, unmarshal, error-context, upgrades

A serialization library upgrade can stop populating the struct and field context on errors returned from user-defined unmarshal methods, so code that matches those fields for logs or messages silently changes. Compare the old and new error values for the same input, restore the context on the custom-method path, and document which fields are set. Test top-level, struct-field, and slice-element type errors, checking each field against the previous release.
