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 release` when the number of positional arguments is not exactly 2. The expected signature is `vagrant cloud version release <org/box-name> <version> [-f|--force]`; after parse_options runs, any argv.size != 2 raises Vagrant::Errors::CLIInvalidUsage with the command's OptionParser help text interpolated into %{help}. The two argv entries are then split into the box (org/name) and the version string to release on Vagrant Cloud.

Source

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

            options = {}

            opts = OptionParser.new do |o|
              o.banner = "Usage: vagrant cloud version release [options] organization/box-name version"
              o.separator ""
              o.separator "Releases a version entry on Vagrant Cloud"
              o.separator ""
              o.separator "Options:"
              o.separator ""
              o.on("-f", "--[no-]force", "Release 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.release_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]

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

          # Release the box version
          #

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Re-run with exactly two positional arguments: `vagrant cloud version release <org>/<box-name> <version>` (e.g. `vagrant cloud version release hashicorp/bionic64 1.0.0`).
  2. Run `vagrant cloud version release -h` and match the printed Usage line.
  3. Add `-f`/`--force` to skip the y/N confirmation once arguments are correct.

Example fix

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

Strategy: validation

Validate before calling

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

Try / catch

begin
  Vagrant::Environment.new.cli(['cloud', 'version', 'release', 'org/box', '1.0.0'])
rescue Vagrant::Errors::CLIInvalidUsage => e
  warn e.message # contains the full help text; fail fast, do not retry
  exit 1
end

Prevention

When it happens

Trigger: `vagrant cloud version release` with 0, 1, or 3+ positional args: e.g. `vagrant cloud version release hashicorp/bionic64` (version missing), `vagrant cloud version release hashicorp/bionic64 1.0.0 extra`, or embedding the version in the box string (`... release hashicorp/bionic64/1.0.0`). Flags like -f are consumed by the parser and do not count toward the required 2.

Common situations: Assuming the version argument is optional; pasting a full Vagrant Cloud box URL instead of the org/box short name; running the command inside scripts where a variable for the version is empty and collapses to one arg.

Related errors


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