{"record":{"id":"d354bf9fe8dc8910","repo":"vitessio/vitess","slug":"can-t-parse-binlog-event-invalid-data-v-d354bf","errorCode":null,"errorMessage":"can't parse binlog event: invalid data: %#v","messagePattern":"can't parse binlog event: invalid data: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/vttablet/tabletserver/vstreamer/vstreamer.go","lineNumber":523,"sourceCode":"\t\t\tif err := injectHeartbeat(!ok, checkResult.Summary()); err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tvs.vse.errorCounts.Add(\"Send\", 1)\n\t\t\t\treturn vterrors.Wrapf(err, \"failed to send heartbeat event\")\n\t\t\t}\n\t\t}\n\t}\n}\n\n// parseEvent parses an event from the binlog and converts it to a list of VEvents.\n// The bufferAndTransmit function must be passed if the event is a TransactionPayloadEvent\n// as for larger payloads (> ZstdInMemoryDecompressorMaxSize) the internal events need\n// to be streamed directly here in order to avoid holding the entire payload's contents,\n// which can be 10s or even 100s of GiBs, all in memory.\nfunc (vs *vstreamer) parseEvent(ev mysql.BinlogEvent, bufferAndTransmit func(vevent *binlogdatapb.VEvent) error) ([]*binlogdatapb.VEvent, error) {\n\tif !ev.IsValid() {\n\t\treturn nil, fmt.Errorf(\"can't parse binlog event: invalid data: %#v\", ev)\n\t}\n\n\t// We need to keep checking for FORMAT_DESCRIPTION_EVENT even after we've\n\t// seen one, because another one might come along (e.g. on log rotate due to\n\t// binlog settings change) that changes the format.\n\tif ev.IsFormatDescription() {\n\t\tvar err error\n\t\tvs.format, err = ev.Format()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"can't parse FORMAT_DESCRIPTION_EVENT: %v, event data: %#v\", err, ev)\n\t\t}\n\t\tvs.eventGTID = nil\n\t\treturn nil, nil\n\t}\n\n\t// We can't parse anything until we get a FORMAT_DESCRIPTION_EVENT that\n\t// tells us the size of the event header.\n\tif vs.format.IsZero() {","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L505-L541","documentation":"parseEvent rejects any binlog event that fails ev.IsValid() — the raw event bytes from the MySQL binlog connection are malformed/truncated and cannot be decoded. This is a hard data-integrity failure of the binlog stream.","triggerScenarios":"mysql.BinlogEvent delivered by the binlog connection where IsValid() returns false — truncated or corrupt event buffer, protocol desync, or garbage bytes from the binlog dump.","commonSituations":"Corrupted binlog files on disk (disk issues, abnormal mysqld kill), network truncation between mysqld and the tablet, MySQL/binlog format incompatibilities, binlog rotated mid-read with corruption.","solutions":["Check mysqld logs and run CHECK TABLE / verify binlog integrity on the source; corruption is usually on the MySQL side.","Restart the vstreamer from an earlier GTID or from the start of the current binlog file; if the file is corrupt, purge/rotate binlogs and resync the workflow.","Compare MySQL server version with vitess support matrix; if using an exotic binlog format/feature (e.g. unusual encryption), disable it or upgrade vitess.","If reproducible on healthy binlogs, capture the event dump (%#v output) and file a vitess bug with the MySQL version."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := vs.streamLog(ctx)\nif err != nil && strings.Contains(err.Error(), \"can't parse binlog event\") {\n    // binlog corruption: restart from an earlier GTID / rotate logs, then resync\n    restartFromEarlierGTID(ctx)\n    if stillFailing { resyncWorkflow(ctx) }\n}","preventionTips":["Monitor MySQL binlog integrity and disk health on the source","Keep MySQL versions within vitess's supported matrix","Avoid hard-killing mysqld; use graceful shutdowns","Restart vstreams from a known-good GTID after binlog issues"],"tags":["vstreamer","binlog","corruption"],"backgroundTag":"binlog-event-parse-failure","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}