vitessio/vitess · error

the <tablet alias> and <duration> arguments are required for

Error message

the <tablet alias> and <duration> arguments are required for the Sleep command

What it means

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.

Source

Thrown at go/vt/vtctl/vtctl.go:1255

		return errors.New("the <tablet alias> argument is required for the RunHealthCheck command")
	}
	tabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))
	if err != nil {
		return err
	}

	_, err = wr.VtctldServer().RunHealthCheck(ctx, &vtctldatapb.RunHealthCheckRequest{
		TabletAlias: tabletAlias,
	})
	return err
}

func commandSleep(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {
	if err := subFlags.Parse(args); err != nil {
		return err
	}
	if subFlags.NArg() != 2 {
		return errors.New("the <tablet alias> and <duration> arguments are required for the Sleep command")
	}
	tabletAlias, err := topoproto.ParseTabletAlias(subFlags.Arg(0))
	if err != nil {
		return err
	}
	duration, err := time.ParseDuration(subFlags.Arg(1))
	if err != nil {
		return err
	}

	_, err = wr.VtctldServer().SleepTablet(ctx, &vtctldatapb.SleepTabletRequest{
		TabletAlias: tabletAlias,
		Duration:    protoutil.DurationToProto(duration),
	})
	return err
}

func commandExecuteFetchAsApp(ctx context.Context, wr *wrangler.Wrangler, subFlags *pflag.FlagSet, args []string) error {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Re-run with both arguments as single tokens: `vtctl Sleep zone1-0000000100 30s`.
  2. Use Go duration syntax without spaces (30s, 5m, 1h30m).
  3. Quote the duration if your shell interprets it oddly.
  4. Check `vtctl Sleep --help` for accepted formats.

Example fix

// before
vtctl Sleep zone1-0000000100
// after
vtctl Sleep zone1-0000000100 30s
Defensive patterns

Strategy: validation

Validate before calling

alias="zone1-0000000100"
duration="30s"
if [ -z "$alias" ] || [ -z "$duration" ] || [ $# -ne 2 ]; then
  echo "usage: vtctl Sleep <tablet alias> <duration>" >&2
  exit 2
fi
vtctl Sleep "$alias" "$duration"

Try / catch

out, err := exec.Command("vtctl", "Sleep", alias, duration).CombinedOutput()
if err != nil {
    if strings.Contains(string(out), "Sleep command") {
        return fmt.Errorf("need exactly 2 args (alias, duration like 30s)")
    }
    return err
}

Prevention

When it happens

Trigger: Running `vtctl Sleep` with fewer than two arguments (alias only or nothing) or more than two. NArg() != 2 triggers the error.

Common situations: 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.

Related errors


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