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 auth logout` when any positional argument is present. The command takes no arguments at all - it instantiates the Cloud client and clears the stored token - so any extra word after `logout` triggers the usage error with the embedded help.

Source

Thrown at plugins/commands/cloud/auth/logout.rb:24

module VagrantPlugins
  module CloudCommand
    module AuthCommand
      module Command
        class Logout < Vagrant.plugin("2", :command)
          def execute
            options = {}

            opts = OptionParser.new do |o|
              o.banner = "Usage: vagrant cloud auth logout"
              o.separator ""
              o.separator "Log out of Vagrant Cloud"
            end

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

            @client = Client.new(@env)
            @client.clear_token
            @env.ui.success(I18n.t("cloud_command.logged_out"))
            return 0
          end
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Run the bare command: `vagrant cloud auth logout`
  2. Run `vagrant cloud auth logout --help` to confirm it accepts no arguments
  3. Remove stray words from scripts

Example fix

# before
vagrant cloud auth logout now

# after
vagrant cloud auth logout
Defensive patterns

Strategy: validation

Validate before calling

# bash: logout accepts no positional arguments
[ $# -eq 0 ] || { vagrant cloud auth logout --help; exit 1; }
vagrant cloud auth logout

Prevention

When it happens

Trigger: `vagrant cloud auth logout now`, `vagrant cloud auth logout --all`, or any invocation leaving positional words after parse_options.

Common situations: Copy-paste from other CLIs where logout takes a flag or scope; shell aliases appending words.

Related errors


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