{"record":{"id":"68284a9a83c0a522","repo":"vitessio/vitess","slug":"uuid-values-must-be-unique","errorCode":null,"errorMessage":"UUID values must be unique","messagePattern":"UUID values must be unique","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schemamanager/tablet_executor.go","lineNumber":99,"sourceCode":"\tddlStrategySetting, err := schema.ParseDDLStrategy(ddlStrategy)\n\tif err != nil {\n\t\treturn err\n\t}\n\texec.ddlStrategySetting = ddlStrategySetting\n\treturn nil\n}\n\n// SetUUIDList sets a (possibly empty) list of provided UUIDs for schema migrations\nfunc (exec *TabletExecutor) SetUUIDList(uuids []string) error {\n\tuuidsMap := map[string]bool{}\n\tfor _, uuid := range uuids {\n\t\tif !schema.IsOnlineDDLUUID(uuid) {\n\t\t\treturn fmt.Errorf(\"Not a valid UUID: %s\", uuid)\n\t\t}\n\t\tuuidsMap[uuid] = true\n\t}\n\tif len(uuidsMap) != len(uuids) {\n\t\treturn errors.New(\"UUID values must be unique\")\n\t}\n\texec.uuids = uuids\n\treturn nil\n}\n\n// hasProvidedUUIDs returns true when UUIDs were provided\nfunc (exec *TabletExecutor) hasProvidedUUIDs() bool {\n\treturn len(exec.uuids) != 0\n}\n\n// Open opens a connection to the primary for every shard.\nfunc (exec *TabletExecutor) Open(ctx context.Context, keyspace string) error {\n\tif !exec.isClosed {\n\t\treturn nil\n\t}\n\texec.keyspace = keyspace\n\tshards, err := exec.ts.FindAllShardsInKeyspace(ctx, keyspace, nil)\n\tif err != nil {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schemamanager/tablet_executor.go#L81-L117","documentation":"SetUUIDList validates the UUID list provided to a TabletExecutor. Each UUID must be a valid Online DDL UUID and all values must be distinct; it returns this error when the deduplication map's size is smaller than the input slice, i.e. duplicates were supplied.","triggerScenarios":"Calling SetUUIDList with a slice containing the same Online DDL UUID more than once.","commonSituations":"Batching migration UUIDs from configuration or scripts that accidentally repeat an entry; copy-paste errors in explicit-UUID migration execution.","solutions":["Deduplicate the UUID slice before passing it to SetUUIDList","Fix the source configuration/script so each migration UUID appears once","Validate UUIDs with schema.IsOnlineDDLUUID and a uniqueness check before submission"],"exampleFix":"// before\nuuids := []string{\"a1b2...\", \"a1b2...\"}\nexec.SetUUIDList(ctx, uuids) // UUID values must be unique\n// after\nseen := map[string]bool{}\nvar unique []string\nfor _, u := range uuids {\n    if !seen[u] {\n        seen[u] = true\n        unique = append(unique, u)\n    }\n}\nexec.SetUUIDList(ctx, unique)","handlingStrategy":"validation","validationCode":"func uniqueUUIDs(uuids []string) bool {\n\tseen := map[string]bool{}\n\tfor _, u := range uuids {\n\t\tif seen[u] { return false }\n\t\tseen[u] = true\n\t}\n\treturn true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate UUID lists before executor setup","Generate UUIDs programmatically instead of hand-copying","Validate with schema.IsOnlineDDLUUID and uniqueness checks upstream"],"tags":["schemamanager","uuid","validation"],"backgroundTag":"duplicate-identifier","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}