vitessio/vitess · error
Not implemented, post_header_length!=8
Error message
Not implemented, post_header_length!=8
What it means
NewTableMapEvent can only synthesize a table-map binlog event when the binlog format's post-header length for table-map events is 8 bytes. If the format declares a different header size, the builder panics because the encoding logic only supports the 8-byte layout.
Source
Thrown at go/mysql/binlog_event_make.go:333
data[10] = byte(gtid.Domain >> 16)
data[11] = byte(gtid.Domain >> 24)
const FLStandalone = 1
var flags2 byte
if !hasBegin {
flags2 |= FLStandalone
}
data[12] = flags2
ev := s.Packetize(f, eMariaGTIDEvent, 0, data)
return NewMariadbBinlogEvent(ev)
}
// NewTableMapEvent returns a TableMap event.
// Only works with post_header_length=8.
func NewTableMapEvent(f BinlogFormat, s *FakeBinlogStream, tableID uint64, tm *TableMap) BinlogEvent {
if f.HeaderSize(eTableMapEvent) != 8 {
panic("Not implemented, post_header_length!=8")
}
metadataLength := metadataTotalLength(tm.Types)
length := 6 + // table_id
2 + // flags
1 + // schema name length
len(tm.Database) +
1 + // [00]
1 + // table name length
len(tm.Name) +
1 + // [00]
lenEncIntSize(uint64(len(tm.Types))) + // column-count len enc
len(tm.Types) +
lenEncIntSize(uint64(metadataLength)) + // lenenc-str column-meta-def
metadataLength +
len(tm.CanBeNull.data)
data := make([]byte, length)View on GitHub (pinned to 01a25a7d17)
Solutions
- Configure the BinlogFormat so the table-map event header size is 8 (as produced by MySQL 5.1+/MariaDB with row-based replication).
- Parse the format from a real Format Description event instead of hard-coding header sizes.
- If you must support other header sizes, extend NewTableMapEvent rather than reusing it.
Example fix
// before f.HeaderSize[eTableMapEvent] = 6 ev := mysql.NewTableMapEvent(f, s, tableID, tm) // panics // after f.HeaderSize[eTableMapEvent] = 8 ev := mysql.NewTableMapEvent(f, s, tableID, tm)
Defensive patterns
Strategy: validation
Validate before calling
if f.HeaderSize(mysql.ETableMapEvent) != 8 {
return errors.New("table-map post_header_length must be 8")
}
ev := mysql.NewTableMapEvent(f, s, tableID, tm) Try / catch
func makeTableMap(f mysql.BinlogFormat, s *mysql.FakeBinlogStream, id uint64, tm *mysql.TableMap) (ev mysql.BinlogEvent, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("NewTableMapEvent: %v", r)
}
}()
return mysql.NewTableMapEvent(f, s, id, tm), nil
} Prevention
- Derive BinlogFormat from a real Format Description event instead of hand-crafting it.
- Assert header sizes in test setup before building events.
- Keep the table-map header size consistent with the server flavor you emulate (8 for modern RBR).
When it happens
Trigger: Calling mysql.NewTableMapEvent with a BinlogFormat whose HeaderSize(eTableMapEvent) is not 8 (e.g. a fake format built with a 6-byte post-header length).
Common situations: Unit tests or tools constructing binlog events with hand-crafted BinlogFormat values copied from a different event type or an older MySQL/MariaDB flavor; misconfigured fake streams in test harnesses.
Related errors
- Not implemented, post_header_length==6
- bad encoding
- metadataLength: unhandled data type: %v
- metadataRead: unhandled data type: %v
- GetPreviousGTIDs: previous GTIDs not found
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/8fa6c352c1b542be.
Report an issue: GitHub.