{"record":{"id":"6f653dfab19fd182","repo":"apache/beam","slug":"decodemultichunkstream-invalid-chunk-size-v","errorCode":null,"errorMessage":"decodeMultiChunkStream invalid chunk size: %v","messagePattern":"decodeMultiChunkStream invalid chunk size: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/exec/fullvalue.go","lineNumber":378,"sourceCode":"\t\ts.ret = FullValue{}\n\t\treturn nil, io.EOF\n\tcase s.chunk > 0:\n\t\terr := s.d.DecodeTo(s.r, &s.ret)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"decodeStream value decode failed\")\n\t\t}\n\t\ts.next++\n\t\treturn &s.ret, nil\n\tcase s.chunk == -1:\n\t\t// State Backed Iterable!\n\t\tstream, err := s.open(s.r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ts.stream = stream\n\t\treturn s.stream.Read()\n\t}\n\treturn nil, errors.Errorf(\"decodeMultiChunkStream invalid chunk size: %v\", s.chunk)\n}\n","sourceCodeStart":360,"sourceCodeEnd":380,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/exec/fullvalue.go#L360-L380","documentation":"After reading a chunk size varint, the multi-chunk decode stream only recognizes 0 (end of stream), a positive size, and -1 (state-backed iterable). Any other value is a protocol violation and produces 'decodeMultiChunkStream invalid chunk size: %v'. It indicates the byte stream has desynchronized from the expected chunk framing.","triggerScenarios":"Read() falls through to the final return because s.chunk is negative (other than -1) after DecodeVarInt — i.e. the reader consumed garbage bytes as the chunk length due to a prior misread or corrupt transport data.","commonSituations":"A custom coder in the chain read a wrong number of bytes, shifting subsequent framing; corrupted or interleaved data-plane payloads; an SDK version mismatch producing a different wire framing than the decoder expects.","solutions":["Rerun the bundle; if it recurs deterministically, inspect custom coders for byte-count misreads that desynchronize framing.","Confirm all workers use the same SDK version as the pipeline expansion.","Enable runner debug logs to compare the sender's payload framing with what the reader consumed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"invalid chunk size\") {\n    // framing desync: retry the bundle; investigate custom coders if deterministic\n    return retryable\n}","preventionTips":["Audit custom coders for exact byte-count reads/writes.","Avoid mixing SDK versions across workers.","Treat deterministic recurrence as a coder/framing bug, not a transport issue."],"tags":["go","apache-beam","decoding","protocol-violation"],"backgroundTag":"stream-decode-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}