{"record":{"id":"c3f9cd925e56d488","repo":"thanos-io/thanos","slug":"proto-unexpected-end-of-group","errorCode":null,"errorMessage":"proto: unexpected end of group","messagePattern":"proto: unexpected end of group","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/status/statuspb/rpc.pb.go","lineNumber":2006,"sourceCode":"\t\tcase 5:\n\t\t\tiNdEx += 4\n\t\tdefault:\n\t\t\treturn 0, fmt.Errorf(\"proto: illegal wireType %d\", wireType)\n\t\t}\n\t\tif iNdEx < 0 {\n\t\t\treturn 0, ErrInvalidLengthRpc\n\t\t}\n\t\tif depth == 0 {\n\t\t\treturn iNdEx, nil\n\t\t}\n\t}\n\treturn 0, io.ErrUnexpectedEOF\n}\n\nvar (\n\tErrInvalidLengthRpc        = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowRpc          = fmt.Errorf(\"proto: integer overflow\")\n\tErrUnexpectedEndOfGroupRpc = fmt.Errorf(\"proto: unexpected end of group\")\n)\n","sourceCodeStart":1988,"sourceCodeEnd":2008,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/status/statuspb/rpc.pb.go#L1988-L2008","documentation":"ErrUnexpectedEndOfGroupRpc is a gogo-protobuf generated sentinel returned when parsing an unknown/legacy group wire type: an end-of-group tag (wire type 4) arrives when no group is open (depth == 0), meaning the byte stream ends a group that was never started. The data is structurally invalid protobuf.","triggerScenarios":"Unmarshaling bytes containing a group-end tag without a matching group-start tag, e.g. from truncated or concatenated messages in exemplarspb/statuspb decoding paths.","commonSituations":"Truncated network reads, offset miscalculation when reading messages from packed files or buckets, or legacy proto2 group fields misinterpreted by proto3 code.","solutions":["Confirm reads are not truncated (check io.ReadFull / buffer bounds upstream).","Avoid proto2 groups; regenerate schema with message types instead.","Verify message framing (length-delimited) when concatenating multiple messages in one buffer.","Treat as corrupt input and surface a deserialization error to the caller."],"exampleFix":"// before\nmsg := &exemplarspb.Exemplars{}\nif err := proto.Unmarshal(buf, msg); err != nil { return err }\n// after\nif err := proto.Unmarshal(buf, msg); err != nil {\n    return errors.Wrap(err, \"failed to decode exemplars: input may be truncated or corrupt\")\n}","handlingStrategy":"try-catch","validationCode":"if len(data) == 0 { return errors.New(\"empty protobuf payload\") }","typeGuard":null,"tryCatchPattern":"if err := proto.Unmarshal(data, msg); err != nil {\n    if errors.Is(err, ErrUnexpectedEndOfGroupRpc) { return errors.Wrap(err, \"truncated or misframed protobuf message\") }\n    return err\n}","preventionTips":["Use length-delimited framing for streams of messages","Avoid proto2 group fields","Detect truncation at the transport layer"],"tags":["protobuf","unmarshal","group-wire-type"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}