{"record":{"id":"f89a9a11bc96cb88","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-f89a9a","errorCode":null,"errorMessage":"This command was not invoked properly. The help for this command is\navailable below.\n\n%{help}","messagePattern":"This command was not invoked properly\\. The help for this command is\navailable below\\.\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidUsage","httpStatus":null,"severity":"error","filePath":"plugins/commands/cloud/auth/login.rb","lineNumber":41,"sourceCode":"              end\n              o.on(\"-d\", \"--description DESCRIPTION\", String, \"Set description for the Vagrant Cloud token\") do |d|\n                options[:description] = d\n              end\n\n              o.on(\"-t\", \"--token TOKEN\", String, \"Set the Vagrant Cloud token\") do |t|\n                options[:token] = t\n              end\n\n              o.on(\"-u\", \"--username USERNAME_OR_EMAIL\", String, \"Vagrant Cloud username or email address\") do |l|\n                options[:login] = l\n              end\n            end\n\n            # Parse the options\n            argv = parse_options(opts)\n            return if !argv\n            if !argv.empty?\n              raise Vagrant::Errors::CLIInvalidUsage,\n                help: opts.help.chomp\n            end\n\n            client = Client.new(@env)\n            client.username_or_email = options[:login]\n\n            # Determine what task we're actually taking based on flags\n            if options[:check]\n              return execute_check(client)\n            elsif options[:token]\n              return execute_token(client, options[:token])\n            else\n              if client.logged_in?\n                @env.ui.success(I18n.t(\"cloud_command.check_logged_in\"))\n              else\n                client_login(@env, options.slice(:login, :description))\n              end\n            end","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/cloud/auth/login.rb#L23-L59","documentation":"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.","triggerScenarios":"`vagrant cloud auth login myuser@example.com` - passing the username as a word instead of the -u flag; any extra positional argument.","commonSituations":"Assuming credential-style commands take positional arguments; migrating from older/other CLI conventions where login takes the user as an argument.","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"],"exampleFix":"# before\nvagrant cloud auth login myuser\n\n# after\nvagrant cloud auth login -u myuser","handlingStrategy":"validation","validationCode":"# bash: login takes flags only - reject stray positional args\n[ $# -eq 0 ] || { vagrant cloud auth login --help; exit 1; }\nvagrant cloud auth login -u \"$CLOUD_USER\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","usage","cloud","auth","arguments"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}