{"record":{"id":"45dd982d9299ebd0","repo":"apache/beam","slug":"readsimplerowheader-expected-no-nils-encoded-count-got-v","errorCode":null,"errorMessage":"ReadSimpleRowHeader expected no nils encoded count, got %v","messagePattern":"ReadSimpleRowHeader expected no nils encoded count, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row.go","lineNumber":225,"sourceCode":"\n// ReadSimpleRowHeader is a convenience function to read Beam Schema Row Headers\n// for values that do not have any nil fields. Reads and validates the number of\n// fields total (returning an error for mismatches, and checks that there are\n// no nils encoded as a bit field.\nfunc ReadSimpleRowHeader(fields int, r io.Reader) error {\n\tn, err := DecodeVarInt(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReadSimpleRowHeader field count: %v, %v\", n, err)\n\t}\n\tif int(n) != fields {\n\t\treturn fmt.Errorf(\"ReadSimpleRowHeader field count mismatch, got %v, want %v\", n, fields)\n\t}\n\tn, err = DecodeVarInt(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReadSimpleRowHeader reading nils count: %v, %v\", n, err)\n\t}\n\tif n != 0 {\n\t\treturn fmt.Errorf(\"ReadSimpleRowHeader expected no nils encoded count, got %v\", n)\n\t}\n\treturn nil\n}\n","sourceCodeStart":207,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row.go#L207-L229","documentation":"After reading the nils count from a simple row header, ReadSimpleRowHeader requires it to be zero (simple rows encode no nils). A non-zero value means the stream was produced by a coder variant that encodes nils (e.g. the full/nils-aware header), not the simple one. The library rejects this to avoid mis-decoding.","triggerScenarios":"Decoding a row whose header contains a non-zero nils count with the simple-header decoder path (ut1Dec or anonymous decoder in row decoding), i.e. the data was encoded with a nils-aware coder but read with the simple coder.","commonSituations":"Mixing coder types between encode and decode stages; data written by an older/newer Beam version with different header conventions; manually constructing or editing encoded rows.","solutions":["Encode and decode with the same coder type: if rows may contain nils, use the coder variant that supports nils on both sides.","Regenerate the serialized data with the matching encoder rather than hand-editing encoded bytes.","Check Beam SDK version parity between the producer and consumer of the encoded rows.","Inspect the first bytes of the stream to confirm which header format was used before choosing a decoder."],"exampleFix":"// before: reading nils-encoding data with the simple decoder\nrow, err := simpleDec.Decode(r)\n// after: use the coder that matches how the data was encoded\nrow, err := nilsAwareDec.Decode(r)","handlingStrategy":"validation","validationCode":"// Confirm coder type used at encode time matches the decoder; log coder ID on both sides before decode.","typeGuard":"func usesSimpleCoder(c beam.Coder) bool { return strings.Contains(fmt.Sprintf(\"%T\", c), \"Simple\") }","tryCatchPattern":"row, err := dec.Decode(r)\nif err != nil && strings.Contains(err.Error(), \"expected no nils encoded count\") {\n    return ErrCoderMismatch\n}","preventionTips":["Use the same coder variant for encode and decode","Avoid hand-crafting encoded row bytes","Pin the Beam SDK version across pipeline stages"],"tags":["go","serialization","decoding","coder-mismatch"],"backgroundTag":"schema-validation-failed","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"}