{"record":{"id":"4e5c8907a9d5e40b","repo":"apache/beam","slug":"unable-to-decode-slice-iterable-with-size-d","errorCode":null,"errorMessage":"unable to decode slice iterable with size: %d","messagePattern":"unable to decode slice iterable with size: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/iterable.go","lineNumber":123,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\trv := reflect.MakeSlice(rt, 0, int(chunk))\n\t\t\tfor chunk != 0 {\n\t\t\t\trvi := reflect.MakeSlice(rt, int(chunk), int(chunk))\n\t\t\t\tif err := decodeToIterable(rvi, r, decodeToElem); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trv = reflect.AppendSlice(rv, rvi)\n\t\t\t\tchunk, err = DecodeVarInt(r)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tret.Set(rv)\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"unable to decode slice iterable with size: %d\", n)\n\t\t}\n\t}\n}\n\n// iterableDecoderForArray can decode from only the fixed sized and\n// multi-chunk variant of the beam iterable protocol.\n// Returns an error for other protocols (such as state backed).\nfunc iterableDecoderForArray(rt reflect.Type, decodeToElem typeDecoderFieldReflect) func(reflect.Value, io.Reader) error {\n\treturn func(ret reflect.Value, r io.Reader) error {\n\t\t// (1) Read count prefixed encoded data\n\t\tsize, err := DecodeInt32(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tn := int(size)\n\t\tif rt.Len() != n {\n\t\t\treturn errors.Errorf(\"len mismatch decoding a %v: want %d got %d\", rt, rt.Len(), n)\n\t\t}","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/iterable.go#L105-L141","documentation":"During decoding of a slice-typed iterable, the decoder's switch over the iterable size encoding reached its default case: the int32 size n decoded from the stream is not a value the slice decoder handles. The Beam iterable protocol encodes size as int32 and only specific values are valid per variant. This indicates a corrupt or incompatibly encoded stream rather than user input error.","triggerScenarios":"Decoding a Beam iterable stream whose decoded int32 size n falls into the unhandled default branch of the slice iterable decoder — typically a negative sentinel this variant does not support.","commonSituations":"Cross-version data replay where an older pipeline wrote iterables with an encoding this decoder does not recognize; corrupted shuffle or windmill data streams.","solutions":["Verify the data was encoded by a compatible Beam version/coder","Re-run the pipeline so data is re-encoded with the current coder","Inspect the raw stream around the failure to confirm corruption"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"v, err := decodeIterable(r)\nif err != nil {\n    if strings.Contains(err.Error(), \"unable to decode slice iterable with size\") {\n        return nil, fmt.Errorf(\"incompatible iterable stream, re-encode from source: %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Keep Beam versions consistent across write and read stages","Avoid replaying stored intermediates from much older Beam releases","Prefer re-running pipelines over replaying encoded data"],"tags":["go","beam","iterable","decoding"],"backgroundTag":"unexpected-response-shape","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}