{"record":{"id":"2092b5192ea8a502","repo":"vitessio/vitess","slug":"not-implemented-post-header-length-6","errorCode":null,"errorMessage":"Not implemented, post_header_length==6","messagePattern":"Not implemented, post_header_length==6","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/mysql/binlog_event_make.go","lineNumber":423,"sourceCode":"}\n\n// NewUpdateRowsEvent returns an UpdateRows event. Uses v2.\nfunc NewUpdateRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent {\n\treturn newRowsEvent(f, s, eUpdateRowsEventV2, tableID, rows)\n}\n\n// NewDeleteRowsEvent returns an DeleteRows event. Uses v2.\nfunc NewDeleteRowsEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, rows Rows) BinlogEvent {\n\treturn newRowsEvent(f, s, eDeleteRowsEventV2, tableID, rows)\n}\n\n// newRowsEvent can create an event of type:\n// eWriteRowsEventV1, eWriteRowsEventV2,\n// eUpdateRowsEventV1, eUpdateRowsEventV2,\n// eDeleteRowsEventV1, eDeleteRowsEventV2.\nfunc newRowsEvent(f BinlogFormat, s *FakeBinlogStream, typ byte, tableID uint64, rows Rows) BinlogEvent {\n\tif f.HeaderSize(typ) == 6 {\n\t\tpanic(\"Not implemented, post_header_length==6\")\n\t}\n\n\thasIdentify := typ == eUpdateRowsEventV1 || typ == eUpdateRowsEventV2 ||\n\t\ttyp == eDeleteRowsEventV1 || typ == eDeleteRowsEventV2\n\thasData := typ == eWriteRowsEventV1 || typ == eWriteRowsEventV2 ||\n\t\ttyp == eUpdateRowsEventV1 || typ == eUpdateRowsEventV2\n\n\trowLen := rows.DataColumns.Count()\n\tif hasIdentify {\n\t\trowLen = rows.IdentifyColumns.Count()\n\t}\n\n\tlength := 6 + // table id\n\t\t2 + // flags\n\t\t2 + // extra data length, no extra data.\n\t\tlenEncIntSize(uint64(rowLen)) + // num columns\n\t\tlen(rows.IdentifyColumns.data) + // only > 0 for Update & Delete\n\t\tlen(rows.DataColumns.data) // only > 0 for Write & Update","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/mysql/binlog_event_make.go#L405-L441","documentation":"newRowsEvent (behind NewWriteRowsEvent, NewUpdateRowsEvent, NewDeleteRowsEvent) only supports row-events with a post-header length of 8 (V2-style). If the binlog format's header size for the row event type is 6 (the old V1 layout), the constructor panics because the 6-byte layout is not implemented.","triggerScenarios":"Calling NewWriteRowsEvent / NewUpdateRowsEvent / NewDeleteRowsEvent with a BinlogFormat whose HeaderSize(typ) == 6 for the requested row-event type.","commonSituations":"Testing against synthetic formats modeled on very old MySQL 5.1 row events (V1); copying header sizes from the table-map event (6 in some flavors) into row-event header sizes; tools replaying legacy binlog formats.","solutions":["Use a BinlogFormat with an 8-byte post-header length for the row event type (V2 events, MySQL 5.6+).","Parse the format description from the actual binlog rather than fabricating header sizes.","If V1 row events must be produced/parsed, implement a separate code path."],"exampleFix":"// before\nf.HeaderSize[eWriteRowsEventV2] = 6\nev := mysql.NewWriteRowsEvent(f, s, id, rows) // panics\n// after\nf.HeaderSize[eWriteRowsEventV2] = 8\nev := mysql.NewWriteRowsEvent(f, s, id, rows)","handlingStrategy":"validation","validationCode":"if f.HeaderSize(mysql.EWriteRowsEventV2) == 6 {\n    return errors.New(\"row-event post_header_length 6 (V1) is unsupported\")\n}\nev := mysql.NewWriteRowsEvent(f, s, tableID, rows)","typeGuard":null,"tryCatchPattern":"func safeRowsEvent(make func() mysql.BinlogEvent) (ev mysql.BinlogEvent, err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"rows event: %v\", r)\n        }\n    }()\n    return make(), nil\n}","preventionTips":["Use V2 row events (8-byte post-header) in all fabricated BinlogFormats.","Validate f.HeaderSize for every event type you plan to construct, in one test.","Do not copy header sizes between event types; each type has its own."],"tags":["mysql","binlog","panics","unsupported"],"backgroundTag":"unsupported-binlog-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}