{"record":{"id":"ea73f3045a94fcbd","repo":"istio/istio","slug":"unmarshal-listener-v","errorCode":null,"errorMessage":"unmarshal listener: %v","messagePattern":"unmarshal listener: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"istioctl/pkg/writer/envoy/configdump/listener.go","lineNumber":600,"sourceCode":"}\n\nfunc (c *ConfigWriter) retrieveSortedListenerSlice() ([]*listener.Listener, error) {\n\tif c.configDump == nil {\n\t\treturn nil, fmt.Errorf(\"config writer has not been primed\")\n\t}\n\tlistenerDump, err := c.configDump.GetListenerConfigDump()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listener dump: %v\", err)\n\t}\n\tlisteners := make([]*listener.Listener, 0)\n\tfor _, l := range listenerDump.DynamicListeners {\n\t\tif l.ActiveState != nil && l.ActiveState.Listener != nil {\n\t\t\tlistenerTyped := &listener.Listener{}\n\t\t\t// Support v2 or v3 in config dump. See ads.go:RequestedTypes for more info.\n\t\t\tl.ActiveState.Listener.TypeUrl = v3.ListenerType\n\t\t\terr = l.ActiveState.Listener.UnmarshalTo(listenerTyped)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unmarshal listener: %v\", err)\n\t\t\t}\n\t\t\tlisteners = append(listeners, listenerTyped)\n\t\t}\n\t}\n\n\tfor _, l := range listenerDump.StaticListeners {\n\t\tif l.Listener != nil {\n\t\t\tlistenerTyped := &listener.Listener{}\n\t\t\t// Support v2 or v3 in config dump. See ads.go:RequestedTypes for more info.\n\t\t\tl.Listener.TypeUrl = v3.ListenerType\n\t\t\terr = l.Listener.UnmarshalTo(listenerTyped)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unmarshal listener: %v\", err)\n\t\t\t}\n\t\t\tlisteners = append(listeners, listenerTyped)\n\t\t}\n\t}\n\tif len(listeners) == 0 {","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/istio/istio/blob/8dc789c5cf17517c64e3c36cb3288230f149dfae/istioctl/pkg/writer/envoy/configdump/listener.go#L582-L618","documentation":"Wrapped error in retrieveSortedListenerSlice (istioctl/pkg/writer/envoy/configdump/listener.go:600): a DynamicListeners entry with an ActiveState failed Any.UnmarshalTo into the v3 listener.Listener message. The code force-sets TypeUrl to v3.ListenerType before unmarshaling (the comment cites v2/v3 support), so failure means the serialized bytes are not a decodable v3 Listener — corrupt dump or proto incompatibility.","triggerScenarios":"A dynamic listener whose ActiveState.Listener payload fails protobuf decode: dumps from an Envoy whose Listener proto is incompatible with the istioctl build's go-control-plane, or bytes corrupted in transit/storage. Static listeners take the parallel path at listener.go:613.","commonSituations":"Version skew between istioctl and the data plane; config dumps copied between environments through lossy tooling; experimental Envoy builds emitting changed listener fields.","solutions":["Align istioctl with the mesh version (this decoder is version-sensitive by design)","Re-pull the dump directly from the pod to eliminate copy corruption","Inspect the offending listener in the raw JSON dump to identify which filter payload fails to decode"],"exampleFix":"// before\ndump, _ := os.ReadFile(\"listener-dump.json\")\ncw.Prime(dump)\nerr := cw.PrintListenerSummary(f) // \"unmarshal listener: proto: ...\"\n\n// after: validate decode per section and report which dump is bad\nif err := cw.Prime(dump); err != nil {\n    return fmt.Errorf(\"bad dump file: %w\", err)\n}\nif err := cw.PrintListenerSummary(f); err != nil {\n    return fmt.Errorf(\"dump %s likely from incompatible version: %w\", dumpPath, err)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := cw.PrintListenerSummary(f); err != nil {\n    if strings.Contains(err.Error(), \"unmarshal listener\") {\n        return fmt.Errorf(\"listener proto undecodable (skew/corruption); refetch dump and align istioctl version: %w\", err)\n    }\n    return err\n}","preventionTips":["Version-match istioctl to the data plane before decoding dumps","Always re-pull dumps from the pod when decode errors appear","Preserve dump bytes exactly (no text-mode transforms) in CI artifacts"],"tags":["istio","istioctl","configdump","listeners","protobuf","version-skew","go"],"backgroundTag":null,"analyzedSha":"8dc789c5cf17517c64e3c36cb3288230f149dfae","analyzedAt":"2026-08-15T15:16:55.434Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}