{"record":{"id":"b622a10470c454e8","repo":"vitessio/vitess","slug":"the-cell-argument-is-required-for-the-updatecell","errorCode":null,"errorMessage":"the <cell> argument is required for the UpdateCellInfo command","messagePattern":"the <cell> argument is required for the UpdateCellInfo command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/cell_info.go","lineNumber":103,"sourceCode":"\n\t_, err := wr.VtctldServer().AddCellInfo(ctx, &vtctldatapb.AddCellInfoRequest{\n\t\tName: cell,\n\t\tCellInfo: &topodatapb.CellInfo{\n\t\t\tServerAddress: *serverAddress,\n\t\t\tRoot:          *root,\n\t\t},\n\t})\n\treturn err\n}\n\nfunc commandUpdateCellInfo(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tserverAddress := subFlags.String(\"server_address\", \"\", \"The address the topology server is using for that cell.\")\n\troot := subFlags.String(\"root\", \"\", \"The root path the topology server is using for that cell.\")\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 <cell> argument is required for the UpdateCellInfo command\")\n\t}\n\tcell := subFlags.Arg(0)\n\n\t_, err := wr.VtctldServer().UpdateCellInfo(ctx, &vtctldatapb.UpdateCellInfoRequest{\n\t\tName: cell,\n\t\tCellInfo: &topodatapb.CellInfo{\n\t\t\tServerAddress: *serverAddress,\n\t\t\tRoot:          *root,\n\t\t},\n\t})\n\treturn err\n}\n\nfunc commandDeleteCellInfo(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tforce := subFlags.Bool(\"force\", false, \"Proceeds even if the cell's topology server cannot be reached. The assumption is that you turned down the entire cell, and just need to update the global topo data.\")\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/cell_info.go#L85-L121","documentation":"commandUpdateCellInfo validates that exactly one positional argument (the cell name) was supplied after flag parsing. This error is returned when the caller ran `UpdateCellInfo` with zero positional arguments or more than one. UpdateCellInfo mutates a cell's CellInfo (server address, root path) in the global topology, so the target cell name is mandatory.","triggerScenarios":"Running `vtctldclient UpdateCellInfo` with no cell name, or passing the cell name before flags so pflag consumes it as a flag value, or passing two positional arguments (subFlags.NArg() != 1).","commonSituations":"Forgotten cell argument in scripts; quoting mistakes that split the cell name into two args; reordering arguments so the cell name is swallowed by a flag like --server_address.","solutions":["Re-run with exactly one positional argument: `vtctldclient UpdateCellInfo --server-address <addr> --root <root> <cell>`","Place the cell name after all flags so pflag does not consume it","Quote the cell name if it contains spaces to keep NArg()==1"],"exampleFix":"// before\nvtctldclient UpdateCellInfo --server-address zone1-1:5999\n// after\nvtctldclient UpdateCellInfo --server-address zone1-1:5999 zone1","handlingStrategy":"validation","validationCode":"args := flagSet.Args()\nif len(args) != 1 {\n    return errors.New(\"the <cell> argument is required for the UpdateCellInfo command\")\n}\ncell := args[0]","typeGuard":"func hasExactlyOneArg(args []string) bool { return len(args) == 1 }","tryCatchPattern":"if err := commandUpdateCellInfo(ctx, wr, subFlags, args); err != nil {\n    if strings.Contains(err.Error(), \"the <cell> argument is required\") {\n        log.Printf(\"usage: UpdateCellInfo [--server-address <addr>] [--root <root>] <cell>\")\n    }\n    return err\n}","preventionTips":["Always put the cell name as the last token after all flags","Quote cell names containing special characters","Check `vtctldclient <command> --help` for the expected positional signature"],"tags":["cli","argument-validation","topology","vtctldclient"],"backgroundTag":"missing-required-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}