lima-vm/lima · error

%#q %s. See `%s --help`. Usage: %s %s

Error message

%#q %s.
See `%s --help`.

Usage:  %s

%s

What it means

This is a wrapper around cobra argument-validation errors (WrapArgsError) in cmd/limactl/main.go:293. When a subcommand's Args validator rejects the positional arguments (e.g. wrong count), limactl re-formats the message with the command path, usage line, and short description so the user immediately sees the correct invocation. The inner err.Error() is the actual validation problem.

Source

Thrown at cmd/limactl/main.go:293

			},
		}
		// Don't show the url scheme helper in the help output.
		if strings.HasPrefix(plugin.Name, "url-") {
			pluginCmd.Hidden = true
		}
		rootCmd.AddCommand(pluginCmd)
	}
}

// WrapArgsError annotates cobra args error with some context, so the error message is more user-friendly.
func WrapArgsError(argFn cobra.PositionalArgs) cobra.PositionalArgs {
	return func(cmd *cobra.Command, args []string) error {
		err := argFn(cmd, args)
		if err == nil {
			return nil
		}

		return fmt.Errorf("%#q %s.\nSee `%s --help`.\n\nUsage:  %s\n\n%s",
			cmd.CommandPath(), err.Error(),
			cmd.CommandPath(),
			cmd.UseLine(), cmd.Short,
		)
	}
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Read the embedded Usage line in the error and supply the required arguments
  2. Run `limactl <cmd> --help` for the exact argument list
  3. Guard shell scripts: fail early if `"$INSTANCE"` is empty before invoking limactl

Example fix

// before
INSTANCE=""
limactl delete $INSTANCE   # limactl "limactl delete": requires at least 1 arg(s)...
// after
[ -n "$INSTANCE" ] || { echo "instance required"; exit 1; }
limactl delete "$INSTANCE"
Defensive patterns

Strategy: validation

Validate before calling

# validate arg counts before invoking limactl
[ $# -ge 1 ] || { echo "usage: limactl delete <instance>..." >&2; exit 1; }

Try / catch

if err := cmd.Execute(); err != nil {
	if strings.Contains(err.Error(), "See `limactl") && strings.Contains(err.Error(), "Usage:") {
		fmt.Fprintln(os.Stderr, err) // message already embeds usage
	}
	os.Exit(1)
}

Prevention

When it happens

Trigger: Calling any limactl subcommand with the wrong number of positional arguments — e.g. `limactl delete` with no instance, `limactl cp` with a single argument, `limactl network create` with a missing name — where the command defines cobra.ExactArgs/RangeArgs/min-max validators.

Common situations: Scripting mistakes where a variable holding the instance name is empty; forgetting that some commands take two arguments (cp, mv); copying examples for the wrong subcommand.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/f5a22020d42b4d0c. Report an issue: GitHub.