{"record":{"id":"f5a22020d42b4d0c","repo":"lima-vm/lima","slug":"q-s-see-s-help-usage-s-s","errorCode":null,"errorMessage":"%#q %s.\nSee `%s --help`.\n\nUsage:  %s\n\n%s","messagePattern":"%#q (.+?)\\.\nSee `(.+?) --help`\\.\n\nUsage:  (.+?)\n\n(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/main.go","lineNumber":293,"sourceCode":"\t\t\t},\n\t\t}\n\t\t// Don't show the url scheme helper in the help output.\n\t\tif strings.HasPrefix(plugin.Name, \"url-\") {\n\t\t\tpluginCmd.Hidden = true\n\t\t}\n\t\trootCmd.AddCommand(pluginCmd)\n\t}\n}\n\n// WrapArgsError annotates cobra args error with some context, so the error message is more user-friendly.\nfunc WrapArgsError(argFn cobra.PositionalArgs) cobra.PositionalArgs {\n\treturn func(cmd *cobra.Command, args []string) error {\n\t\terr := argFn(cmd, args)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"%#q %s.\\nSee `%s --help`.\\n\\nUsage:  %s\\n\\n%s\",\n\t\t\tcmd.CommandPath(), err.Error(),\n\t\t\tcmd.CommandPath(),\n\t\t\tcmd.UseLine(), cmd.Short,\n\t\t)\n\t}\n}\n","sourceCodeStart":275,"sourceCodeEnd":300,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/main.go#L275-L300","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the embedded Usage line in the error and supply the required arguments","Run `limactl <cmd> --help` for the exact argument list","Guard shell scripts: fail early if `\"$INSTANCE\"` is empty before invoking limactl"],"exampleFix":"// before\nINSTANCE=\"\"\nlimactl delete $INSTANCE   # limactl \"limactl delete\": requires at least 1 arg(s)...\n// after\n[ -n \"$INSTANCE\" ] || { echo \"instance required\"; exit 1; }\nlimactl delete \"$INSTANCE\"","handlingStrategy":"validation","validationCode":"# validate arg counts before invoking limactl\n[ $# -ge 1 ] || { echo \"usage: limactl delete <instance>...\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if err := cmd.Execute(); err != nil {\n\tif strings.Contains(err.Error(), \"See `limactl\") && strings.Contains(err.Error(), \"Usage:\") {\n\t\tfmt.Fprintln(os.Stderr, err) // message already embeds usage\n\t}\n\tos.Exit(1)\n}","preventionTips":["Quote and default-check shell variables used as instance names","Confirm arg counts against `limactl <cmd> --help`","Note two-arg commands (cp, mv) require both src and dst"],"tags":["cli","arguments","cobra"],"backgroundTag":"invalid-command-arguments","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}