hashicorp/vagrant · error · Vagrant::Errors::CLIInvalidUsage

This command was not invoked properly. The help for this com

Error message

This command was not invoked properly. The help for this command is available below. %{help}

What it means

`vagrant cloud provider update` requires four or five positional arguments: `organization/box-name`, provider name, version, architecture, and optionally a URL. Fewer than four (most often a missing architecture) or more than five raises CLIInvalidUsage with the command help.

Source

Thrown at plugins/commands/cloud/provider/update.rb:42

              o.on("-a", "--architecture ARCH", String, "Update architecture value of guest box") do |a|
                options[:architecture] = a
              end
              o.on("-c", "--checksum CHECKSUM_VALUE", String, "Checksum of the box for this provider. --checksum-type option is required.") do |c|
                options[:checksum] = c
              end
              o.on("-C", "--checksum-type TYPE", String, "Type of checksum used (md5, sha1, sha256, sha384, sha512). --checksum option is required.") do |c|
                options[:checksum_type] = c
              end
              o.on("--[no-]default-architecture", "Mark as default architecture for specific provider") do |d|
                options[:default_architecture] = d
              end
            end

            # Parse the options
            argv = parse_options(opts)
            return if !argv
            if argv.count < 4 || argv.count > 5
              raise Vagrant::Errors::CLIInvalidUsage,
                help: opts.help.chomp
            end

            @client = client_login(@env)

            org, box_name = argv.first.split('/', 2)
            provider_name = argv[1]
            version = argv[2]
            architecture = argv[3]
            url = argv[4]

            update_provider(org, box_name, version, provider_name, architecture, url, @client.token, options)
          end

          # Update a provider for the box version
          #
          # @param [String] org Organization name
          # @param [String] box Box name

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Use the exact form: `vagrant cloud provider update org/box-name provider version architecture [url]`
  2. Pass checksum changes as options: --checksum, --checksum-type
  3. Confirm with `vagrant cloud provider update -h`

Example fix

# before
vagrant cloud provider update myorg/mybox virtualbox 1.0.0
# after
vagrant cloud provider update myorg/mybox virtualbox 1.0.0 amd64
Defensive patterns

Strategy: validation

Validate before calling

# Ruby: enforce the 4-or-5 argument contract before invoking
pos = args.select { |a| !a.start_with?("-") }
unless (4..5).cover?(pos.size)
  abort "usage: vagrant cloud provider update org/box-name provider version architecture [url]"
end

Try / catch

begin
  env.cli(%w[cloud provider update], org_box, provider, version, arch, url)
rescue Vagrant::Errors::CLIInvalidUsage => e
  $stderr.puts e.message.lines.first
  exit 64
end

Prevention

When it happens

Trigger: `vagrant cloud provider update myorg/mybox virtualbox 1.0.0` (architecture missing, count is 3); six or more positionals from passing the URL both positionally and via option; unquoted identifiers splitting.

Common situations: Porting scripts from `provider create`, which does not require architecture; forgetting that update targets a specific architecture entry; appending checksum values as bare arguments.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/59256dc2d200b36b. Report an issue: GitHub.