{"record":{"id":"64af85a3b21365bc","repo":"vitessio/vitess","slug":"the-alias-argument-is-required-for-the-updatecel","errorCode":null,"errorMessage":"the <alias> argument is required for the UpdateCellsAlias command","messagePattern":"the <alias> argument is required for the UpdateCellsAlias command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/cells_aliases.go","lineNumber":95,"sourceCode":"\tfor i, cell := range *cells {\n\t\t(*cells)[i] = strings.TrimSpace(cell)\n\t}\n\n\talias := subFlags.Arg(0)\n\t_, err := wr.VtctldServer().AddCellsAlias(ctx, &vtctldatapb.AddCellsAliasRequest{\n\t\tName:  alias,\n\t\tCells: *cells,\n\t})\n\treturn err\n}\n\nfunc commandUpdateCellsAlias(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tcells := subFlags.StringSlice(\"cells\", nil, \"The list of cell names that are members of this alias.\")\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tif subFlags.NArg() != 1 {\n\t\treturn errors.New(\"the <alias> argument is required for the UpdateCellsAlias command\")\n\t}\n\n\tfor i, cell := range *cells {\n\t\t(*cells)[i] = strings.TrimSpace(cell)\n\t}\n\n\talias := subFlags.Arg(0)\n\t_, err := wr.VtctldServer().UpdateCellsAlias(ctx, &vtctldatapb.UpdateCellsAliasRequest{\n\t\tName: alias,\n\t\tCellsAlias: &topodatapb.CellsAlias{\n\t\t\tCells: *cells,\n\t\t},\n\t})\n\treturn err\n}\n\nfunc commandDeleteCellsAlias(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tif err := subFlags.Parse(args); err != nil {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/cells_aliases.go#L77-L113","documentation":"commandUpdateCellsAlias modifies an existing cells alias and requires exactly one positional argument: the alias name. The new member list is passed via the --cells flag. The error is returned when subFlags.NArg() != 1.","triggerScenarios":"Running `vtctldclient UpdateCellsAlias --cells a,b` without the alias positional argument, or adding extra positional tokens so NArg() != 1.","commonSituations":"Mirroring the AddCellsAlias mistake of putting the alias at the wrong position; automation where the alias variable is empty; thinking member cells go positionally.","solutions":["Re-run as `vtctldclient UpdateCellsAlias --cells <cell1,cell2,...> <alias>`","Ensure the alias already exists (create it with AddCellsAlias first if needed)","Keep exactly one positional argument after all flags"],"exampleFix":"// before\nvtctldclient UpdateCellsAlias --cells zone2,zone3\n// after\nvtctldclient UpdateCellsAlias --cells zone2,zone3 dcalias","handlingStrategy":"validation","validationCode":"args := flagSet.Args()\ncells := flagSet.GetStringSlice(\"cells\", nil)\nif len(args) != 1 || len(cells) == 0 {\n    return errors.New(\"the <alias> argument is required for the UpdateCellsAlias command\")\n}\nalias := args[0]","typeGuard":"func hasExactlyOneArg(args []string) bool { return len(args) == 1 }","tryCatchPattern":"if err := commandUpdateCellsAlias(ctx, wr, subFlags, args); err != nil {\n    if strings.Contains(err.Error(), \"the <alias> argument is required\") {\n        log.Printf(\"usage: UpdateCellsAlias --cells <cell1,cell2,...> <alias>\")\n    }\n    return err\n}","preventionTips":["Verify the alias exists (AddCellsAlias) before updating","Keep exactly one positional argument; cells only via --cells","Check alias shell variables are non-empty"],"tags":["cli","argument-validation","topology","cells-alias"],"backgroundTag":"missing-required-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}