{"record":{"id":"c68c872ef4912fc9","repo":"vitessio/vitess","slug":"can-t-parse-intvar-event-v-event-data-v","errorCode":null,"errorMessage":"can't parse INTVAR_EVENT: %v, event data: %#v","messagePattern":"can't parse INTVAR_EVENT: (.+?), event data: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/binlog_streamer.go","lineNumber":379,"sourceCode":"\t\t\t}\n\t\tcase ev.IsGTID(): // GTID_EVENT: update current GTID, maybe BEGIN.\n\t\t\tvar hasBegin bool\n\t\t\tgtid, hasBegin, _, _, err = ev.GTID(format)\n\t\t\tif err != nil {\n\t\t\t\treturn pos, fmt.Errorf(\"can't get GTID from binlog event: %v, event data: %#v\", err, ev)\n\t\t\t}\n\t\t\tpos = replication.AppendGTID(pos, gtid)\n\t\t\tif hasBegin {\n\t\t\t\tbegin()\n\t\t\t}\n\t\tcase ev.IsXID(): // XID_EVENT (equivalent to COMMIT)\n\t\t\tif err = commit(ev.Timestamp()); err != nil {\n\t\t\t\treturn pos, err\n\t\t\t}\n\t\tcase ev.IsIntVar(): // INTVAR_EVENT\n\t\t\ttyp, value, err := ev.IntVar(format)\n\t\t\tif err != nil {\n\t\t\t\treturn pos, fmt.Errorf(\"can't parse INTVAR_EVENT: %v, event data: %#v\", err, ev)\n\t\t\t}\n\t\t\tstatements = append(statements, FullBinlogStatement{\n\t\t\t\tStatement: &binlogdatapb.BinlogTransaction_Statement{\n\t\t\t\t\tCategory: binlogdatapb.BinlogTransaction_Statement_BL_SET,\n\t\t\t\t\tSql:      fmt.Appendf(nil, \"SET %s=%d\", mysql.IntVarNames[typ], value),\n\t\t\t\t},\n\t\t\t})\n\t\tcase ev.IsRand(): // RAND_EVENT\n\t\t\tseed1, seed2, err := ev.Rand(format)\n\t\t\tif err != nil {\n\t\t\t\treturn pos, fmt.Errorf(\"can't parse RAND_EVENT: %v, event data: %#v\", err, ev)\n\t\t\t}\n\t\t\tstatements = append(statements, FullBinlogStatement{\n\t\t\t\tStatement: &binlogdatapb.BinlogTransaction_Statement{\n\t\t\t\t\tCategory: binlogdatapb.BinlogTransaction_Statement_BL_SET,\n\t\t\t\t\tSql:      fmt.Appendf(nil, \"SET @@RAND_SEED1=%d, @@RAND_SEED2=%d\", seed1, seed2),\n\t\t\t\t},\n\t\t\t})","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlog_streamer.go#L361-L397","documentation":"INTVAR_EVENTs carry SET statements for internal variables (LAST_INSERT_ID, INSERT_ID). parseEvents decodes them with ev.IntVar(format); a failure means the event body doesn't match the expected intvar layout, so the equivalent SET statement cannot be reconstructed and the stream aborts.","triggerScenarios":"During Stream/parseEvents, ev.IsIntVar() is true and ev.IntVar(format) errors because the event body is shorter than 9 bytes or otherwise malformed relative to the format's header size.","commonSituations":"Binlog files corrupted or truncated mid-event; replication through a proxy that drops bytes; binlog written by an unusual server build; disk issues on the primary.","solutions":["Run mysqlbinlog on the affected binlog file to check for corruption","Restore a healthy binlog source (fail over to a replica with intact logs) and restart the stream from the last good GTID","Check disk/filesystem health on the primary producing these binlogs","Bypass any proxies or intermediaries that may truncate binlog dump packets"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := streamer.Stream(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"INTVAR_EVENT\") {\n\t\t// corrupt intvar event: verify with mysqlbinlog, fail over, restart from last good GTID\n\t}\n}","preventionTips":["Monitor primary disk/filesystem health to prevent binlog corruption","Avoid unreliable intermediaries on the replication path","Regularly validate binlog readability with mysqlbinlog on primaries"],"tags":["binlog","intvar","corruption","parsing"],"backgroundTag":"corrupt-binlog-event","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}