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

Raised by `vagrant cloud version revoke` when the number of positional arguments is not exactly 2. Expected signature: `vagrant cloud version revoke <org/box-name> <version> [-f|--force]`; argv.size != 2 after option parsing raises Vagrant::Errors::CLIInvalidUsage with the help text in %{help}. The first arg is split on '/' into org and box name, the second is the version to revoke.

Source

Thrown at plugins/commands/cloud/version/revoke.rb:32

            options = {}

            opts = OptionParser.new do |o|
              o.banner = "Usage: vagrant cloud version revoke [options] organization/box-name version"
              o.separator ""
              o.separator "Revokes a version entry on Vagrant Cloud"
              o.separator ""
              o.separator "Options:"
              o.separator ""
              o.on("-f", "--[no-]force", "Force revocation without confirmation") do |f|
                options[:force] = f
              end
            end

            # Parse the options
            argv = parse_options(opts)
            return if !argv
            if argv.size != 2
              raise Vagrant::Errors::CLIInvalidUsage,
                help: opts.help.chomp
            end

            if !options[:force]
              @env.ui.warn(I18n.t("cloud_command.version.revoke_warn", version: argv[1], box: argv.first))
              cont = @env.ui.ask(I18n.t("cloud_command.continue"))
              return 1 if cont.strip.downcase != "y"
            end

            @client = client_login(@env)
            org, box_name = argv.first.split('/', 2)
            version = argv[1]

            revoke_version(org, box_name, version, @client.token, options)
          end

          # Revoke release of box version
          #

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Re-run with exactly two positional arguments: `vagrant cloud version revoke <org>/<box-name> <version>`.
  2. Run `vagrant cloud version revoke -h` to confirm the usage line.
  3. Add `-f` to revoke without the confirmation prompt once the args parse.

Example fix

# before
vagrant cloud version revoke hashicorp/bionic64
# after
vagrant cloud version revoke hashicorp/bionic64 1.0.0
Defensive patterns

Strategy: validation

Validate before calling

abort 'usage: vagrant cloud version revoke <org/box> <version>' unless ARGV.length == 2 && ARGV.first.include?('/')
system('vagrant', 'cloud', 'version', 'revoke', *ARGV)

Try / catch

begin
  Vagrant::Environment.new.cli(['cloud', 'version', 'revoke', 'org/box', '1.0.0'])
rescue Vagrant::Errors::CLIInvalidUsage => e
  warn e.message
  exit 1
end

Prevention

When it happens

Trigger: `vagrant cloud version revoke` with 0, 1, or 3+ positional args, e.g. `vagrant cloud version revoke hashicorp/bionic64` (forgot the version) or `vagrant cloud version revoke hashicorp bionic64 1.0.0` (split the org/box into two words).

Common situations: Revoking a bad version in a hurry and omitting the version token; forgetting that org and box must be one slash-joined word; copy-pasting from docs that show a placeholder like <org>/<box> <version> without filling both.

Related errors


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