{"record":{"id":"63534c91effc2b2f","repo":"vitessio/vitess","slug":"the-cell-argument-is-required-for-the-getcellinf","errorCode":null,"errorMessage":"the <cell> argument is required for the GetCellInfo command","messagePattern":"the <cell> argument is required for the GetCellInfo command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/cell_info.go","lineNumber":154,"sourceCode":"\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)\n\tif err != nil {\n\t\treturn err\n\t}\n\twr.Logger().Printf(\"%v\\n\", strings.Join(names, \"\\n\"))\n\treturn nil\n}\n\nfunc commandGetCellInfo(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() != 1 {\n\t\treturn errors.New(\"the <cell> argument is required for the GetCellInfo command\")\n\t}\n\n\t// We use a strong read, because users using this command want the\n\t// latest data, and this is user-generated, not used in any\n\t// automated process.\n\tcell := subFlags.Arg(0)\n\tci, err := wr.TopoServer().GetCellInfo(ctx, cell, true /*strongRead*/)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn printJSON(wr.Logger(), ci)\n}\n","sourceCodeStart":136,"sourceCodeEnd":167,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/cell_info.go#L136-L167","documentation":"commandGetCellInfo fetches the CellInfo (server address, root) for a single cell and requires exactly one positional argument: the cell name. The error is returned when subFlags.NArg() != 1. It performs a strong read so users always see the latest user-generated topology data.","triggerScenarios":"Running `vtctldclient GetCellInfo` with no cell name, or with more than one positional argument.","commonSituations":"Forgetting the cell argument in ad-hoc debugging; an empty shell variable for the cell; confusing it with the no-argument GetCellInfoNames command.","solutions":["Re-run as `vtctldclient GetCellInfo <cell>` with exactly one positional argument","Verify the shell variable holding the cell name is non-empty","Use GetCellInfoNames first to list valid cell names"],"exampleFix":"// before\nvtctldclient GetCellInfo\n// after\nvtctldclient GetCellInfo zone1","handlingStrategy":"validation","validationCode":"args := flagSet.Args()\nif len(args) != 1 {\n    return errors.New(\"the <cell> argument is required for the GetCellInfo command\")\n}\ncell := args[0]","typeGuard":"func hasExactlyOneArg(args []string) bool { return len(args) == 1 }","tryCatchPattern":"if err := commandGetCellInfo(ctx, wr, subFlags, args); err != nil {\n    if strings.Contains(err.Error(), \"the <cell> argument is required\") {\n        log.Printf(\"usage: GetCellInfo <cell>\")\n    }\n    return err\n}","preventionTips":["Run GetCellInfoNames first to confirm valid cell names","Check shell variables for the cell name are non-empty","Keep the cell name after all flags"],"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"}