{"record":{"id":"b05654a3b2c02069","repo":"vitessio/vitess","slug":"cell-set-overlaps-with-existing-alias-v","errorCode":null,"errorMessage":"cell set overlaps with existing alias %v","messagePattern":"cell set overlaps with existing alias (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/cells_aliases.go","lineNumber":208,"sourceCode":"\t\t\t// This includes the 'err=nil' case.\n\t\t\treturn err\n\t\t}\n\t}\n}\n\n// validateAlias checks whether the given alias is allowed.\n// If the alias overlaps with any existing alias other than itself, this returns\n// a non-nil error.\nfunc validateAlias(currentAliases map[string]*topodatapb.CellsAlias, newAliasName string, newAlias *topodatapb.CellsAlias) error {\n\tfor name, alias := range currentAliases {\n\t\t// Skip the alias we're checking against. It's allowed to overlap with itself.\n\t\tif name == newAliasName {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, cell := range alias.Cells {\n\t\t\tif InCellList(cell, newAlias.Cells) {\n\t\t\t\treturn fmt.Errorf(\"cell set overlaps with existing alias %v\", name)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":190,"sourceCodeEnd":214,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/cells_aliases.go#L190-L214","documentation":"validateAlias iterates all existing cells aliases and fails if any cell in the new alias is already a member of a different existing alias (matched via InCellList). Cell-to-alias membership must be disjoint across aliases.","triggerScenarios":"CreateCellsAlias or UpdateCellsAlias when the proposed alias's cell set contains a cell listed in another alias; directly exercised in tests via TestValidateAlias.","commonSituations":"Merging region aliases; typo including a cell that already belongs to another region; legacy aliases from older deployments still holding the cell.","solutions":["List all aliases with GetCellsAliases/vtctldclient GetCellsAliases and remove the conflicting cell from the other alias first.","Restructure aliases so every cell appears in exactly one alias.","If the cell moved permanently, update the old alias (removing the cell) before adding it to the new alias."],"exampleFix":"// before\n// eu: [c1,c2], creating us: [c2,c3] -> overlap on c2\n// after\n// update eu to [c1], then create us: [c2,c3]","handlingStrategy":"validation","validationCode":"func canCreate(aliases map[string]*topodatapb.CellsAlias, name string, cells []string) error {\n    for an, a := range aliases {\n        if an == name { continue }\n        for _, c := range cells {\n            if topo.InCellList(c, a.Cells) { return fmt.Errorf(\"%s in %s\", c, an) }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := validateAgainst(aliases, alias, cells); err != nil {\n    return fmt.Errorf(\"cells alias %v is not valid: %v\", alias, err)\n}","preventionTips":["Maintain a single source of truth mapping cell -> alias.","Lint alias configs for disjointness before applying to topo.","Write a test asserting cell sets are pairwise disjoint."],"tags":["go","topo","cells-alias"],"backgroundTag":"cells-alias-overlap","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}