{"record":{"id":"1a5753bf6c5e04d2","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-1a5753","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/box/command/add.rb","lineNumber":77,"sourceCode":"\n            o.on(\"--checksum CHECKSUM\", String, \"Checksum for the box\") do |c|\n              options[:checksum] = c\n            end\n\n            o.on(\"--checksum-type TYPE\", String, \"Checksum type (md5, sha1, sha256)\") do |c|\n              options[:checksum_type] = c.to_sym\n            end\n\n            o.on(\"--name BOX\", String, \"Name of the box\") do |n|\n              options[:name] = n\n            end\n          end\n\n          # Parse the options\n          argv = parse_options(opts)\n          return if !argv\n          if argv.empty? || argv.length > 2\n            raise Vagrant::Errors::CLIInvalidUsage,\n              help: opts.help.chomp\n          end\n\n          url = argv[0]\n          if argv.length == 2\n            options[:name] = argv[0]\n            url = argv[1]\n          end\n\n          @env.action_runner.run(Vagrant::Action.action_box_add, {\n            box_url: url,\n            box_name: options[:name],\n            box_provider: options[:provider],\n            box_architecture: options[:architecture],\n            box_version: options[:version],\n            box_checksum_type: options[:checksum_type],\n            box_checksum: options[:checksum],\n            box_clean: options[:clean],","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/box/command/add.rb#L59-L95","documentation":"Raised by `vagrant box add` when the positional arguments after flags are empty or number more than two. The command accepts exactly one URL, or a box name plus a URL; argv[0] and argv[1] are consumed as name/URL, so anything else (including no arguments at all) is invalid usage and the help text is shown.","triggerScenarios":"`vagrant box add` with no arguments; `vagrant box add name url extra`; any invocation where parse_options leaves zero or 3+ positional words.","commonSituations":"Assuming a file picker or interactive prompt; forgetting the box shorthand/URL; pasting multiple boxes into one command.","solutions":["Provide a box shorthand or URL: `vagrant box add ubuntu/jammy`","To set an explicit name use two arguments: `vagrant box add my-ubuntu https://example.com/ubuntu.box`","Run `vagrant box add --help` to review checksum/name/clean flags"],"exampleFix":"# before\nvagrant box add\n\n# after\nvagrant box add ubuntu/jammy\n# or with an explicit name\nvagrant box add my-ubuntu https://example.com/ubuntu.box","handlingStrategy":"validation","validationCode":"# bash: box add takes 1 or 2 positionals (url, or name+url)\nif [ $# -lt 1 ] || [ $# -gt 2 ]; then\n  vagrant box add --help; exit 1\nfi\nvagrant box add \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to the shorthand form: `vagrant box add ubuntu/jammy`","Use the --name flag instead of the two-positional form in scripts","Run `vagrant box add --help` to review checksum options for reproducible adds"],"tags":["cli","usage","box","arguments"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}