{"record":{"id":"a017f2c20ccd26af","repo":"vitessio/vitess","slug":"failed-to-parse-pos-column-v","errorCode":null,"errorMessage":"failed to parse pos column: %v","messagePattern":"failed to parse pos column: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/binlog/binlogplayer/binlog_player.go","lineNumber":595,"sourceCode":"\t\treturn VRSettings{}, fmt.Errorf(\"error %v in selecting vreplication settings %v\", err, query)\n\t}\n\n\tif len(qr.Rows) != 1 {\n\t\treturn VRSettings{}, fmt.Errorf(\"checkpoint information not available in db for %v\", uid)\n\t}\n\tvrRow := qr.Named().Row()\n\n\tmaxTPS, err := vrRow.ToInt64(\"max_tps\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_tps column: %v\", err)\n\t}\n\tmaxReplicationLag, err := vrRow.ToInt64(\"max_replication_lag\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse max_replication_lag column: %v\", err)\n\t}\n\tstartPos, err := DecodePosition(vrRow.AsString(\"pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse pos column: %v\", err)\n\t}\n\tstopPos, err := replication.DecodePosition(vrRow.AsString(\"stop_pos\", \"\"))\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse stop_pos column: %v\", err)\n\t}\n\tworkflowType, err := vrRow.ToInt32(\"workflow_type\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse workflow_type column: %v\", err)\n\t}\n\tworkflowSubType, err := vrRow.ToInt32(\"workflow_sub_type\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse workflow_sub_type column: %v\", err)\n\t}\n\tdeferSecondaryKeys, err := vrRow.ToBool(\"defer_secondary_keys\")\n\tif err != nil {\n\t\treturn VRSettings{}, fmt.Errorf(\"failed to parse defer_secondary_keys column: %v\", err)\n\t}\n\toptions := vrRow.AsString(\"options\", \"{}\")","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlogplayer/binlog_player.go#L577-L613","documentation":"The pos column holds the stream's current replication position (GTID set), encoded with replication.EncodePosition. DecodePosition failed, so the stored position string is not a valid GTID set for the flavor (MySQL or MariaDB) or is empty/unreadable.","triggerScenarios":"DecodePosition(vrRow.AsString(\"pos\", \"\")) errors: pos contains an empty string (default used when SQL NULL), a truncated value, a position from a different flavor (e.g. MariaDB GTID in a MySQL tablet), or arbitrary text from manual edits.","commonSituations":"Restoring a target MySQL from a MariaDB source backup (or vice versa); manual updates to pos; pos truncated by column-size limits in hand-edited rows; copying _vt.vreplication rows between clusters with different GTID setups.","solutions":["Read the stored value: `select uid, pos from _vt.vreplication where uid=<id>` and verify it is a valid GTID set (e.g. MySQL: `3E11FA47-...:1-5`).","If invalid, resync the stream: start a fresh workflow or reset pos to a valid position captured from the source (`SHOW MASTER STATUS` / `SELECT @@gtid_executed`).","Ensure the source and target MySQL flavors match; mixed MySQL/MariaDB GTID sets cannot be decoded.","Do not hand-edit pos; use vtctldclient/VExec workflow operations."],"exampleFix":"// before: invalid/empty pos stored manually\nupdate _vt.vreplication set pos='' where uid=1;\n// after: valid MySQL GTID set\nupdate _vt.vreplication set pos='MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5' where uid=1;","handlingStrategy":"validation","validationCode":"qr, _ := dbClient.ExecuteFetch(fmt.Sprintf(\"SELECT pos FROM _vt.vreplication WHERE uid=%d\", uid), 1)\nif len(qr.Rows) == 1 {\n\tp := qr.Named().Row().AsString(\"pos\", \"\")\n\tif _, err := replication.DecodePosition(p); err != nil {\n\t\treturn fmt.Errorf(\"pos %q is not a decodable position for this flavor; resync the stream\", p)\n\t}\n}","typeGuard":"func isValidGTIDPosition(pos string) bool {\n\tif pos == \"\" { return false }\n\t_, err := replication.DecodePosition(pos)\n\treturn err == nil\n}","tryCatchPattern":"settings, err := binlogplayer.ReadVRSettings(dbClient, uid)\nif err != nil && strings.Contains(err.Error(), \"failed to parse pos\") {\n\t// position unrecoverable: stop the stream cleanly and restart the workflow\n\treturn restartWorkflow(ctx, uid)\n}","preventionTips":["Never hand-edit pos; only the player or workflow API should write it.","Keep source and target MySQL flavors identical (MySQL vs MariaDB GTID).","When copying clusters, regenerate positions from the actual source, don't copy rows verbatim.","Validate a position with replication.DecodePosition before persisting it."],"tags":["vreplication","gtid","parsing","data-corruption"],"backgroundTag":"invalid-gtid-position","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}