{"record":{"id":"8676fe5a107ee602","repo":"vitessio/vitess","slug":"err-8676fe","errorCode":null,"errorMessage":"err","messagePattern":"err","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/mysql/replication/replication_position.go","lineNumber":155,"sourceCode":"// after the given GTIDSet is replicated.\nfunc AppendGTIDSetInPlace(rp Position, gtidSet GTIDSet) Position {\n\tif gtidSet == nil {\n\t\treturn rp\n\t}\n\n\tif rp.GTIDSet == nil {\n\t\treturn AppendGTIDSet(rp, gtidSet)\n\t}\n\trp.GTIDSet = rp.GTIDSet.UnionInPlace(gtidSet)\n\treturn rp\n}\n\n// MustParsePosition calls ParsePosition and panics\n// on error.\nfunc MustParsePosition(flavor, value string) Position {\n\trp, err := ParsePosition(flavor, value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn rp\n}\n\n// EncodePosition returns a string that contains both the flavor\n// and value of the Position, so that the correct parser can be\n// selected when that string is passed to DecodePosition.\nfunc EncodePosition(rp Position) string {\n\tif rp.GTIDSet == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s/%s\", rp.GTIDSet.Flavor(), rp.GTIDSet.String())\n}\n\n// DecodePosition converts a string in the format returned by\n// EncodePosition back into a Position value with the\n// correct underlying flavor.\nfunc DecodePosition(s string) (rp Position, err error) {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/mysql/replication/replication_position.go#L137-L173","documentation":"MustParsePosition calls ParsePosition(flavor, value) and panics on error. It parses a replication position string (GTID set) for a given flavor; invalid flavor or malformed GTID set strings crash instead of returning an error. Intended for tests and known-valid constants.","triggerScenarios":"Calling MustParsePosition with an unsupported flavor (anything but MySQL56/MariaDB) or a malformed position value such as \"invalid-gtid-set\" or a GTID set from the wrong flavor syntax.","commonSituations":"Loading positions from config/flags/topology where the string was hand-written, truncated, or produced by a different MySQL flavor.","solutions":["Use ParsePosition and handle the error for any runtime input","Validate the position string format for the expected flavor before calling","Confirm the flavor argument matches the source server type"],"exampleFix":"// before\npos := replication.MustParsePosition(\"MySQL56\", flagPos)\n// after\npos, err := replication.ParsePosition(\"MySQL56\", flagPos)\nif err != nil {\n\treturn vterrors.Wrapf(err, \"invalid position %q\", flagPos)\n}","handlingStrategy":"validation","validationCode":"if _, err := replication.ParsePosition(flavor, value); err != nil {\n\treturn vterrors.Wrapf(err, \"invalid position %q\", value)\n}","typeGuard":null,"tryCatchPattern":"func safeParsePosition(flavor, value string) (pos replication.Position, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"MustParsePosition panicked: %v\", r)\n\t\t}\n\t}()\n\treturn replication.MustParsePosition(flavor, value), nil\n}","preventionTips":["Use ParsePosition for flags, configs, and topology data","Validate flavor before parsing (MySQL56/MariaDB only)","Never hand-edit stored position strings"],"tags":["panic","replication","position","parsing"],"backgroundTag":"invalid-gtid-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}