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 plugin license <name> <license-file>` requires at least two positional arguments. After parse_options, argv.length < 2 raises Vagrant::Errors::CLIInvalidUsage with the help text; argv[0] becomes the plugin name and argv[1] the license path handed to the licensing middleware.

Source

Thrown at plugins/commands/plugin/command/license.rb:20

# SPDX-License-Identifier: BUSL-1.1

require 'optparse'

require_relative "base"

module VagrantPlugins
  module CommandPlugin
    module Command
      class License < Base
        def execute
          opts = OptionParser.new do |o|
            o.banner = "Usage: vagrant plugin license <name> <license-file> [-h]"
          end

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

          # License the plugin
          action(Action.action_license, {
            plugin_license_path: argv[1],
            plugin_name:         argv[0]
          })

          # Success, exit status 0
          0
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Re-run with both arguments: `vagrant plugin license <name> /abs/path/to/license.lic`.
  2. Confirm the usage line with `vagrant plugin license -h`.

Example fix

# before
vagrant plugin license my-plugin
# after
vagrant plugin license my-plugin /home/me/licenses/my-plugin.lic
Defensive patterns

Strategy: validation

Validate before calling

abort 'usage: vagrant plugin license <name> <license-file>' unless ARGV.length >= 2
name, path = ARGV
abort "no such file: #{path}" unless File.file?(File.expand_path(path))
system('vagrant', 'plugin', 'license', name, path)

Try / catch

begin
  Vagrant::Environment.new.cli(['plugin', 'license', name, path])
rescue Vagrant::Errors::CLIInvalidUsage => e
  warn e.message
  exit 1
end

Prevention

When it happens

Trigger: `vagrant plugin license my-plugin` (license path omitted) or bare `vagrant plugin license`; supplying name and path as one quoted word.

Common situations: Typing the command from memory and forgetting the file argument; shell quoting that accidentally joins the two args.

Related errors


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