vitessio/vitess · error

the <alias> argument is required for the UpdateCellsAlias co

Error message

the <alias> argument is required for the UpdateCellsAlias command

What it means

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.

Source

Thrown at go/vt/vtctl/cells_aliases.go:95

	for i, cell := range *cells {
		(*cells)[i] = strings.TrimSpace(cell)
	}

	alias := subFlags.Arg(0)
	_, err := wr.VtctldServer().AddCellsAlias(ctx, &vtctldatapb.AddCellsAliasRequest{
		Name:  alias,
		Cells: *cells,
	})
	return err
}

func commandUpdateCellsAlias(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
	cells := subFlags.StringSlice("cells", nil, "The list of cell names that are members of this alias.")
	if err := subFlags.Parse(args); err != nil {
		return err
	}
	if subFlags.NArg() != 1 {
		return errors.New("the <alias> argument is required for the UpdateCellsAlias command")
	}

	for i, cell := range *cells {
		(*cells)[i] = strings.TrimSpace(cell)
	}

	alias := subFlags.Arg(0)
	_, err := wr.VtctldServer().UpdateCellsAlias(ctx, &vtctldatapb.UpdateCellsAliasRequest{
		Name: alias,
		CellsAlias: &topodatapb.CellsAlias{
			Cells: *cells,
		},
	})
	return err
}

func commandDeleteCellsAlias(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
	if err := subFlags.Parse(args); err != nil {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Re-run as `vtctldclient UpdateCellsAlias --cells <cell1,cell2,...> <alias>`
  2. Ensure the alias already exists (create it with AddCellsAlias first if needed)
  3. Keep exactly one positional argument after all flags

Example fix

// before
vtctldclient UpdateCellsAlias --cells zone2,zone3
// after
vtctldclient UpdateCellsAlias --cells zone2,zone3 dcalias
Defensive patterns

Strategy: validation

Validate before calling

args := flagSet.Args()
cells := flagSet.GetStringSlice("cells", nil)
if len(args) != 1 || len(cells) == 0 {
    return errors.New("the <alias> argument is required for the UpdateCellsAlias command")
}
alias := args[0]

Type guard

func hasExactlyOneArg(args []string) bool { return len(args) == 1 }

Try / catch

if err := commandUpdateCellsAlias(ctx, wr, subFlags, args); err != nil {
    if strings.Contains(err.Error(), "the <alias> argument is required") {
        log.Printf("usage: UpdateCellsAlias --cells <cell1,cell2,...> <alias>")
    }
    return err
}

Prevention

When it happens

Trigger: Running `vtctldclient UpdateCellsAlias --cells a,b` without the alias positional argument, or adding extra positional tokens so NArg() != 1.

Common situations: Mirroring the AddCellsAlias mistake of putting the alias at the wrong position; automation where the alias variable is empty; thinking member cells go positionally.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/64af85a3b21365bc. Report an issue: GitHub.