{"record":{"id":"d70a78b85e7f690f","repo":"apache/beam","slug":"readsimplerowheader-reading-nils-count-v-v","errorCode":null,"errorMessage":"ReadSimpleRowHeader reading nils count: %v, %v","messagePattern":"ReadSimpleRowHeader reading nils count: (.+?), (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/graph/coder/row.go","lineNumber":222,"sourceCode":"\t}\n\treturn nil\n}\n\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":204,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/graph/coder/row.go#L204-L229","documentation":"ReadSimpleRowHeader decodes a simple row header (field count and nils count) from a Beam row encoding stream. While reading the nils count varint it wraps any decode error in this message. It indicates the byte stream ended prematurely or is corrupted at the position where the nils count should be.","triggerScenarios":"Calling ut1Dec / row decoding (e.g. via beam.RowEncoder or exec coders) on a truncated or misaligned byte stream: the field-count varint read succeeded, but the next DecodeVarInt call hit an error (typically io.EOF from a cut-off buffer).","commonSituations":"Truncated serialized rows from a corrupted data file or pipeline transport; decoding a hand-crafted or older-version byte encoding that lacks the nils count field; incorrect re-use of a decoder across stream boundaries.","solutions":["Verify the byte slice/stream is complete and not truncated before decoding (check you wrote/read the full encoded row).","Ensure encoding and decoding use the same beam SDK version and coder (simple row header format changed across versions).","Check that the reader is positioned at the start of a valid encoded row, not mid-record.","Wrap Decode/Encode calls so partial failures invalidate the whole record instead of resuming mid-stream."],"exampleFix":"// before: decoding a possibly truncated buffer\nrow, err := dec.Decode(bytes.NewReader(buf[:10]))\n// after: validate buffer completeness first\nif len(buf) < minHeaderBytes { return fmt.Errorf(\"buffer too short: %d\", len(buf)) }\nrow, err := dec.Decode(bytes.NewReader(buf))","handlingStrategy":"try-catch","validationCode":"if len(buf) < 2 { return fmt.Errorf(\"encoded row too short: %d bytes\", len(buf)) }","typeGuard":"func isTruncated(err error) bool { return errors.Is(err, io.EOF) || strings.Contains(err.Error(), \"reading nils count\") }","tryCatchPattern":"row, err := dec.Decode(r)\nif err != nil {\n    if isTruncated(err) { return ErrIncompleteRecord }\n    return err\n}","preventionTips":["Always write the complete encoded row before attempting to decode","Keep encoder/decoder Beam versions in sync","Frame records with length prefixes when streaming rows"],"tags":["go","serialization","decoding","corrupt-data"],"backgroundTag":"file-read-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"}