You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
roachprod/vm: fix JSON serialization of VM.Errors field
The VM.Errors field was typed as []error, but Go's encoding/json cannot
unmarshal into an error interface type because it doesn't know what
concrete type to create. This caused roachprod list to fail when loading
cached cluster info containing VMs with errors:
json: cannot unmarshal object into Go struct field
VM.vms.errors of type error
This change introduces a VMError wrapper type that:
- Implements the error interface
- Implements json.Marshaler to serialize as a JSON string (error message)
- Implements json.Unmarshaler to handle both the new format (strings) and
legacy format (empty objects from broken serialization)
- Implements Unwrap() so errors.Is/As still work
All cloud providers (AWS, Azure, GCE, IBM) are updated to use the new
VMError type via NewVMError(). The BadInstanceErrors() function now
returns map[string]vm.List (grouped by error message string) instead of
map[error]vm.List since serialization loses pointer identity.
Release note: None
Epic: None
Co-authored-by: Claude <[email protected]>
0 commit comments