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 login` when any positional argument is present after flag parsing (`!argv.empty?`). Login is driven entirely by flags (-u/--username, -t/--token, --check), so leftover words are invalid usage and the OptionParser help is embedded.
Source
Thrown at plugins/commands/cloud/auth/login.rb:41
end
o.on("-d", "--description DESCRIPTION", String, "Set description for the Vagrant Cloud token") do |d|
options[:description] = d
end
o.on("-t", "--token TOKEN", String, "Set the Vagrant Cloud token") do |t|
options[:token] = t
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |l|
options[:login] = l
end
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.username_or_email = options[:login]
# Determine what task we're actually taking based on flags
if options[:check]
return execute_check(client)
elsif options[:token]
return execute_token(client, options[:token])
else
if client.logged_in?
@env.ui.success(I18n.t("cloud_command.check_logged_in"))
else
client_login(@env, options.slice(:login, :description))
end
endView on GitHub (pinned to 35f3160f4a)
Solutions
- Pass the username with the flag: `vagrant cloud auth login -u myuser`
- Or use a token: `vagrant cloud auth login --token <token>`
- Run `vagrant cloud auth login --help` for all flag forms
Example fix
# before vagrant cloud auth login myuser # after vagrant cloud auth login -u myuser
Defensive patterns
Strategy: validation
Validate before calling
# bash: login takes flags only - reject stray positional args
[ $# -eq 0 ] || { vagrant cloud auth login --help; exit 1; }
vagrant cloud auth login -u "$CLOUD_USER" Prevention
- Pass credentials via flags (-u) or VAGRANT_CLOUD_TOKEN, never positionally
- Prefer token-based auth in CI: export VAGRANT_CLOUD_TOKEN=...
- Check --help when a command rejects arguments you assumed were positional
When it happens
Trigger: `vagrant cloud auth login myuser@example.com` - passing the username as a word instead of the -u flag; any extra positional argument.
Common situations: Assuming credential-style commands take positional arguments; migrating from older/other CLI conventions where login takes the user as an argument.
Related errors
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/f89a9a11bc96cb88.
Report an issue: GitHub.