{"record":{"id":"f5766eac9c500826","repo":"vitessio/vitess","slug":"the-cell-argument-is-required-for-the-deletecell","errorCode":null,"errorMessage":"the <cell> argument is required for the DeleteCellInfo command","messagePattern":"the <cell> argument is required for the DeleteCellInfo command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/cell_info.go","lineNumber":123,"sourceCode":"\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}\n\tif subFlags.NArg() != 1 {\n\t\treturn errors.New(\"the <cell> argument is required for the DeleteCellInfo command\")\n\t}\n\tcell := subFlags.Arg(0)\n\n\t_, err := wr.VtctldServer().DeleteCellInfo(ctx, &vtctldatapb.DeleteCellInfoRequest{\n\t\tName:  cell,\n\t\tForce: *force,\n\t})\n\treturn err\n}\n\nfunc commandGetCellInfoNames(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {\n\tif err := subFlags.Parse(args); err != nil {\n\t\treturn err\n\t}\n\tif subFlags.NArg() != 0 {\n\t\treturn errors.New(\"GetCellInfoNames command takes no parameter\")\n\t}\n\tnames, err := wr.TopoServer().GetCellInfoNames(ctx)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/cell_info.go#L105-L141","documentation":"commandDeleteCellInfo requires exactly one positional argument: the name of the cell whose CellInfo record should be removed from the global topology. The error is returned when subFlags.NArg() != 1. A --force flag exists to proceed even when the cell's topology server is unreachable, but the cell name itself is always required.","triggerScenarios":"Running `vtctldclient DeleteCellInfo` with no positional argument, or with more than one, e.g. extra stray tokens after flags.","commonSituations":"Scripted teardown of a decommissioned cell where the cell variable was empty; copy-pasting the --force example and omitting <cell>; accidentally passing 'force' as a positional argument instead of the flag.","solutions":["Re-run as `vtctldclient DeleteCellInfo [--force] <cell>` with exactly one positional argument","Check the script variable holding the cell name is not empty","Use --force (flag form) rather than passing extra positional words"],"exampleFix":"// before\nvtctldclient DeleteCellInfo --force\n// after\nvtctldclient DeleteCellInfo --force zone1","handlingStrategy":"validation","validationCode":"args := flagSet.Args()\nif len(args) != 1 {\n    return errors.New(\"the <cell> argument is required for the DeleteCellInfo command\")\n}\ncell := args[0]","typeGuard":"func hasExactlyOneArg(args []string) bool { return len(args) == 1 }","tryCatchPattern":"if err := commandDeleteCellInfo(ctx, wr, subFlags, args); err != nil {\n    if strings.Contains(err.Error(), \"the <cell> argument is required\") {\n        log.Printf(\"usage: DeleteCellInfo [--force] <cell>\")\n    }\n    return err\n}","preventionTips":["Pass --force as a flag, never as a positional word","Ensure shell variables holding the cell name are non-empty before invoking","Distinguish DeleteCellInfo (cell) from DeleteCellsAlias (alias) in scripts"],"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"}