vitessio/vitess · error
no command was specified
Error message
no command was specified
What it means
RunCommand validates that at least one command argument was supplied to vtctl. When args is empty it prints the full command list to help the user, then returns this error. It is a usage error, not an internal failure.
Source
Thrown at go/vt/vtctl/vtctl.go:4005
}
default:
data, err = json.MarshalIndent(obj, "", " ")
if err != nil {
return nil, fmt.Errorf("json error: %v", err)
}
}
return data, nil
}
// RunCommand will execute the command using the provided wrangler.
// It will return the actionPath to wait on for long remote actions if
// applicable.
func RunCommand(ctx context.Context, wr *wrangler.Wrangler, args []string) error {
if len(args) == 0 {
wr.Logger().Printf("No command specified. Please see the list below:\n\n")
PrintAllCommands(wr.Logger())
return errors.New("no command was specified")
}
action := args[0]
actionLowerCase := strings.ToLower(action)
for _, group := range commands {
for _, cmd := range group.commands {
if strings.ToLower(cmd.name) == actionLowerCase {
subFlags := pflag.NewFlagSet(action, pflag.ContinueOnError)
subFlags.SetOutput(logutil.NewLoggerWriter(wr.Logger()))
subFlags.Usage = func() {
if cmd.deprecated {
msg := &strings.Builder{}
msg.WriteString("WARNING: ")
msg.WriteString(action)
msg.WriteString(" is deprecated and will be removed in a future release.")
if cmd.deprecatedBy != "" {
msg.WriteString(" Use ")
msg.WriteString(cmd.deprecatedBy)View on GitHub (pinned to 01a25a7d17)
Solutions
- Supply a command as the first positional argument, e.g. `vtctl GetKeyspace commerce`
- Check shell scripts for empty variables feeding the command name
- Review the printed command list (or `vtctl --help`) to pick the correct command
Example fix
// before vtctl $FLAGS # CMD variable was empty // after vtctl $FLAGS GetKeyspace commerce
Defensive patterns
Strategy: validation
Validate before calling
if len(args) == 0 {
return fmt.Errorf("usage: vtctl [global flags] <command> [args...]")
} Try / catch
if err := vtctl.RunCommand(ctx, wr, args); err != nil {
if strings.Contains(err.Error(), "no command was specified") {
vtctl.PrintAllCommands(logger)
}
return err
} Prevention
- Quote and default-check shell variables supplying the command name
- Wrap vtctl in a script that asserts $# >= 1 command argument
- Run `vtctl --help` when unsure of command names
When it happens
Trigger: Invoking vtctl without a command (e.g. `vtctl --topo_server ... --topo_root ...` with no command name), or passing only flags so args[0] is missing after flag parsing.
Common situations: Scripts that lost their positional argument due to variable expansion failures ($CMD empty); calling the vtctl library RunCommand directly with an empty slice; wrappers that swallow the command.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- the <tablet alias> argument is required for the SetReadWrite
- action StartReplication requires <tablet alias>
- action StopReplication requires <tablet alias>
- the <tablet alias> and <db type> arguments are required for
- the <tablet alias> argument is required for the Ping command
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/7cceb639b0abd876.
Report an issue: GitHub.