{"record":{"id":"4696a8a16a8f2ef4","repo":"apache/beam","slug":"error-decoding-byte-field","errorCode":null,"errorMessage":"error decoding []byte field","messagePattern":"error decoding \\[\\]byte field","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row_decoder.go","lineNumber":265,"sourceCode":"\t\treturn errors.Wrap(err, \"error decoding single-precision float field\")\n\t}\n\trv.SetFloat(float64(v))\n\treturn nil\n}\n\nfunc reflectDecodeFloat(rv reflect.Value, r io.Reader) error {\n\tv, err := DecodeDouble(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding double field\")\n\t}\n\trv.SetFloat(v)\n\treturn nil\n}\n\nfunc reflectDecodeByteSlice(rv reflect.Value, r io.Reader) error {\n\tb, err := DecodeBytes(r)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error decoding []byte field\")\n\t}\n\trv.SetBytes(b)\n\treturn nil\n}\n\n// customFunc returns nil if no custom func exists for this type.\n// If an error is returned, coder construction should be aborted.\nfunc (b *RowDecoderBuilder) customFunc(t reflect.Type) (func(io.Reader) (any, error), bool, error) {\n\tif fact, ok := b.allFuncs[t]; ok {\n\t\tf, err := fact(t)\n\n\t\tif err != nil {\n\t\t\treturn nil, false, err\n\t\t}\n\t\treturn f, false, nil\n\t}\n\t// Check satisfaction of interface types in reverse registration order.\n\tpt := reflect.PtrTo(t)","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row_decoder.go#L247-L283","documentation":"This error wraps a failure from DecodeBytes while reflectively decoding a []byte field in a Beam row coder. The underlying bytes decoding (length prefix or truncated stream) failed, and the wrapper adds context naming the field kind.","triggerScenarios":"Decoding a Beam pipeline element whose schema has a []byte field, when the byte-slice payload in the stream is truncated, corrupt, or was encoded by an incompatible coder version.","commonSituations":"Mismatched pipeline SDK versions between writer and runner, corrupted/short data in a test transport, or a custom coder writing rows without the expected length prefix.","solutions":["Inspect the wrapped cause (errors.Unwrap) to see if it is EOF/unexpected-EOF and fix the producer to write complete length-prefixed byte slices","Ensure both pipeline stages use the same Beam SDK version so byte-slice encodings match","Re-run the job; if data corruption in the transport is suspected, verify serialization between stages"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if len(data) == 0 { return fmt.Errorf(\"empty byte field\") }","typeGuard":null,"tryCatchPattern":"if _, err := decodeRow(r); err != nil {\n    cause := err\n    for errors.Unwrap(cause) != nil { cause = errors.Unwrap(cause) }\n    log.Printf(\"byte field decode failed: %v\", cause)\n    return err\n}","preventionTips":["Pin the same Beam SDK version across writer and runner","Validate byte-slice payloads are non-empty and length-prefixed at the producer","Add unit tests round-tripping rows containing []byte fields"],"tags":["go","beam","decoding","serialization"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}