{"record":{"id":"02e14f358602166b","repo":"vitessio/vitess","slug":"cells-alias-v-is-not-valid-v","errorCode":null,"errorMessage":"cells alias %v is not valid: %v","messagePattern":"cells alias (.+?) is not valid: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/cells_aliases.go","lineNumber":122,"sourceCode":"func (ts *Server) DeleteCellsAlias(ctx context.Context, alias string) error {\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\tts.clearCellAliasesCache()\n\n\tfilePath := pathForCellsAlias(alias)\n\treturn ts.globalCell.Delete(ctx, filePath, nil)\n}\n\n// CreateCellsAlias creates a new CellInfo with the provided content.\nfunc (ts *Server) CreateCellsAlias(ctx context.Context, alias string, cellsAlias *topodatapb.CellsAlias) error {\n\tcurrentAliases, err := ts.GetCellsAliases(ctx, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := validateAlias(currentAliases, alias, cellsAlias); err != nil {\n\t\treturn fmt.Errorf(\"cells alias %v is not valid: %v\", alias, err)\n\t}\n\n\tts.clearCellAliasesCache()\n\n\t// Pack the content.\n\tcontents, err := cellsAlias.MarshalVT()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Save it.\n\tif ctx.Err() != nil {\n\t\treturn ctx.Err()\n\t}\n\tfilePath := pathForCellsAlias(alias)\n\t_, err = ts.globalCell.Create(ctx, filePath, contents)\n\treturn err\n}","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/cells_aliases.go#L104-L140","documentation":"CreateCellsAlias validates the new alias (via validateAlias) before writing it to the topo and wraps any validation failure with this message. Common causes: alias name already exists, empty cell list, or the alias's cell set overlapping an existing alias's cells.","triggerScenarios":"Calling topo.Server.CreateCellsAlias (or vtctldclient AddCellsAlias) with an alias name that already exists, a cell list that overlaps an existing alias's cells, or otherwise invalid alias data.","commonSituations":"Operators defining region aliases (e.g. region1) in a multi-cell deployment; automation re-running an idempotency-unaware create; overlapping cells between geo aliases.","solutions":["Run GetCellsAliases and check whether the alias name already exists; use UpdateCellsAlias instead to modify it.","Ensure each cell belongs to at most one alias — remove overlapping cells from the new alias.","Check the wrapped error for the specific validation rule that failed (duplicate name, overlap, empty list)."],"exampleFix":"// before\n// cells_us = [cell1, cell2], creating:\nCreateCellsAlias(ctx, \"cells_us\", &topodatapb.CellsAlias{Cells: []string{\"cell2\", \"cell3\"}}) // overlap: cell2\n// after\nCreateCellsAlias(ctx, \"cells_us_west\", &topodatapb.CellsAlias{Cells: []string{\"cell3\"}})","handlingStrategy":"validation","validationCode":"aliases, err := ts.GetCellsAliases(ctx, true)\nif err != nil { return err }\nif _, ok := aliases[alias]; ok {\n    return errors.New(\"cells alias already exists; use update instead\")\n}\nfor name, a := range aliases {\n    for _, c := range cellsAlias.Cells {\n        if topo.InCellList(c, a.Cells) {\n            return fmt.Errorf(\"cell %s already in alias %s\", c, name)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := ts.CreateCellsAlias(ctx, alias, cellsAlias); err != nil {\n    if strings.Contains(err.Error(), \"not valid\") {\n        // inspect wrapped validateAlias error for duplicate/overlap cause\n    }\n    return err\n}","preventionTips":["Make automation idempotent: check GetCellsAliases before create.","Keep each cell in at most one alias; plan moves as remove-then-add.","Preview alias changes with GetCellsAliases before writing."],"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"}