{"record":{"id":"daf3d280dddf2df4","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-daf3d2","errorCode":null,"errorMessage":"This command was not invoked properly. The help for this command is\navailable below.\n\n%{help}","messagePattern":"This command was not invoked properly\\. The help for this command is\navailable below\\.\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidUsage","httpStatus":null,"severity":"error","filePath":"plugins/commands/cap/command.rb","lineNumber":44,"sourceCode":"          o.separator \"\"\n          o.separator \"Options:\"\n          o.separator \"\"\n\n          o.on(\"--check\", \"Only checks for a capability, does not execute\") do |f|\n            options[:check] = f\n          end\n\n          # TODO: Rename this back to `target` to maintain api\n          o.on(\"-t\", \"--target-guest=TARGET\", \"Target guest to run against (if applicable)\") do |t|\n            options[:target] = t\n          end\n        end\n\n        # Parse the options\n        argv = parse_options(opts)\n        return if !argv\n        if argv.length < 2\n          raise Vagrant::Errors::CLIInvalidUsage,\n            help: opts.help.chomp\n        end\n\n        type = argv.shift.to_sym\n        name = argv.shift.to_sym\n\n        # Get the proper capability host to check\n        cap_host = nil\n        if type == :host\n          cap_host = @env.host\n        else\n          with_target_vms(options[:target] || []) do |vm|\n            cap_host = case type\n                       when :provider\n                         vm.provider\n                       when :guest\n                         vm.guest\n                       else","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/cap/command.rb#L26-L62","documentation":"Raised by `vagrant cap` when fewer than two positional arguments remain after option parsing. The command shifts and to_sym's the first two argv entries into type and capability name, so both are mandatory: `vagrant cap <type> <capability-name>` plus optional flags like --check or --target-guest.","triggerScenarios":"`vagrant cap` alone, or `vagrant cap guest` with no capability name - argv.length < 2 after parse_options.","commonSituations":"Exploring the cap command via trial and error; forgetting that the type comes before the capability name.","solutions":["Provide both arguments: `vagrant cap guest read_ip --target-guest default`","Run `vagrant cap --help` to see the expected form and flags","Remember valid types are host, provider, guest"],"exampleFix":"# before\nvagrant cap guest\n\n# after\nvagrant cap guest read_ip --target-guest default","handlingStrategy":"validation","validationCode":"# bash: cap needs <type> <name> at minimum\n[ $# -ge 2 ] || { vagrant cap --help; exit 1; }\nvagrant cap \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the positional order: type first (host|provider|guest), then capability name","Use --check first to probe capability support before running it","Consult `vagrant cap --help` when scripting capability checks"],"tags":["cli","usage","cap","arguments"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}