{"record":{"id":"209d5a1f451d2d67","repo":"vitessio/vitess","slug":"the-tablet-alias-and-duration-arguments-are-re","errorCode":null,"errorMessage":"the <tablet alias> and <duration> arguments are required for the Sleep command","messagePattern":"the <tablet alias> and <duration> arguments are required for the Sleep command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":1255,"sourceCode":"\t\treturn errors.New(\"the <tablet alias> argument is required for the RunHealthCheck command\")\n\t}\n\ttabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = wr.VtctldServer().RunHealthCheck(ctx, &vtctldatapb.RunHealthCheckRequest{\n\t\tTabletAlias: tabletAlias,\n\t})\n\treturn err\n}\n\nfunc commandSleep(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() != 2 {\n\t\treturn errors.New(\"the <tablet alias> and <duration> arguments are required for the Sleep command\")\n\t}\n\ttabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\tduration, err := time.ParseDuration(subFlags.Arg(1))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = wr.VtctldServer().SleepTablet(ctx, &vtctldatapb.SleepTabletRequest{\n\t\tTabletAlias: tabletAlias,\n\t\tDuration:    protoutil.DurationToProto(duration),\n\t})\n\treturn err\n}\n\nfunc commandExecuteFetchAsApp(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L1237-L1273","documentation":"This error is raised by the vtctl commandSleep handler when the Sleep command is not given exactly two positional arguments: a <tablet alias> and a <duration> (Go duration string like 1m30s). Sleep instructs the tablet to pause serving the given duration, mainly for testing. The handler enforces NArg() == 2 before parsing the alias and duration.","triggerScenarios":"Running `vtctl Sleep` with fewer than two arguments (alias only or nothing) or more than two. NArg() != 2 triggers the error.","commonSituations":"Passing the duration with a space inside (e.g. `1 m`) so it splits into two tokens making NArg()==3; forgetting the duration; scripts missing one variable.","solutions":["Re-run with both arguments as single tokens: `vtctl Sleep zone1-0000000100 30s`.","Use Go duration syntax without spaces (30s, 5m, 1h30m).","Quote the duration if your shell interprets it oddly.","Check `vtctl Sleep --help` for accepted formats."],"exampleFix":"// before\nvtctl Sleep zone1-0000000100\n// after\nvtctl Sleep zone1-0000000100 30s","handlingStrategy":"validation","validationCode":"alias=\"zone1-0000000100\"\nduration=\"30s\"\nif [ -z \"$alias\" ] || [ -z \"$duration\" ] || [ $# -ne 2 ]; then\n  echo \"usage: vtctl Sleep <tablet alias> <duration>\" >&2\n  exit 2\nfi\nvtctl Sleep \"$alias\" \"$duration\"","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"vtctl\", \"Sleep\", alias, duration).CombinedOutput()\nif err != nil {\n    if strings.Contains(string(out), \"Sleep command\") {\n        return fmt.Errorf(\"need exactly 2 args (alias, duration like 30s)\")\n    }\n    return err\n}","preventionTips":["Pass exactly two positional args: alias then a Go-style duration (30s, 5m).","Never put spaces inside the duration (use 1h30m, not \"1 h 30 m\").","Quote the duration token in scripts.","Validate duration format with a regex before invoking."],"tags":["vtctl","cli","missing-argument","duration"],"backgroundTag":"missing-required-cli-argument","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}