{"record":{"id":"3c2fa6f3d7bc43b4","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-3c2fa6","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/repackage.rb","lineNumber":20,"sourceCode":"# SPDX-License-Identifier: BUSL-1.1\n\nrequire \"fileutils\"\nrequire 'optparse'\nrequire \"pathname\"\n\nmodule VagrantPlugins\n  module CommandBox\n    module Command\n      class Repackage < Vagrant.plugin(\"2\", :command)\n        def execute\n          opts = OptionParser.new do |o|\n            o.banner = \"Usage: vagrant box repackage <name> <provider> <version>\"\n          end\n\n          # Parse the options\n          argv = parse_options(opts)\n          return if !argv\n          raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length != 3\n\n          box_name     = argv[0]\n          box_provider = argv[1].to_sym\n          box_version  = argv[2]\n\n          # Verify the box exists that we want to repackage\n          box = @env.boxes.find(box_name, box_provider, \"= #{box_version}\")\n          if !box\n            raise Vagrant::Errors::BoxNotFoundWithProviderAndVersion,\n              name: box_name,\n              provider: box_provider.to_s,\n              version: box_version\n          end\n\n          # Repackage the box\n          output_name = @env.vagrantfile.config.package.name || \"package.box\"\n          output_path = Pathname.new(File.expand_path(output_name, FileUtils.pwd))\n          box.repackage(output_path)","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/box/command/repackage.rb#L2-L38","documentation":"Raised by `vagrant box repackage` when the number of positional arguments is not exactly three (name, provider, version). The command indexes argv[0]/argv[1]/argv[2] directly - the provider is even to_sym'd - so the arity is strict and the banner `Usage: vagrant box repackage <name> <provider> <version>` is embedded in the error.","triggerScenarios":"`vagrant box repackage mybox` (missing provider/version), `vagrant box repackage mybox virtualbox` (missing version), or four-plus positional words.","commonSituations":"Assuming the version is optional or defaults to latest; forgetting that repackage needs the exact installed version.","solutions":["Get the exact triple from `vagrant box list` (name, provider, version)","Run: `vagrant box repackage <name> <provider> <version>`","Use --help to confirm the argument order"],"exampleFix":"# before\nvagrant box repackage ubuntu/jammy\n\n# after\nvagrant box list   # find exact version\nvagrant box repackage ubuntu/jammy virtualbox 202303.0.0","handlingStrategy":"validation","validationCode":"# bash: repackage requires exactly 3 positionals: name provider version\n[ $# -eq 3 ] || { vagrant box repackage --help; exit 1; }\nvagrant box repackage \"$1\" \"$2\" \"$3\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the name/provider/version triple straight from `vagrant box list`","Remember the version is mandatory and exact - there is no latest default","Automate: parse `vagrant box list` output to build the repackage arguments"],"tags":["cli","usage","box","repackage","arguments"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}