{"record":{"id":"525178cc7d394c89","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-525178","errorCode":null,"errorMessage":"This command was not invoked properly. The help for this command is available below. %{help}","messagePattern":"This command was not invoked properly\\. The help for this command is available below\\. %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidUsage","httpStatus":null,"severity":"error","filePath":"plugins/commands/plugin/command/expunge.rb","lineNumber":42,"sourceCode":"            end\n\n            o.on(\"--local-only\", \"Only expunge local project plugins\") do |l|\n              options[:env_local_only] = l\n            end\n\n            o.on(\"--global-only\", \"Only expunge global plugins\") do |l|\n              options[:global_only] = l\n            end\n\n            o.on(\"--reinstall\", \"Reinstall current plugins after expunge\") do |reinstall|\n              options[:reinstall] = reinstall\n            end\n          end\n\n          # Parse the options\n          argv = parse_options(opts)\n          return if !argv\n          raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length > 0\n\n          plugins = Vagrant::Plugin::Manager.instance.installed_plugins\n\n          if !options[:reinstall] && !options[:force] && !plugins.empty?\n            result = nil\n            attempts = 0\n            while attempts < 5 && result.nil?\n              attempts += 1\n              result = @env.ui.ask(\n                I18n.t(\"vagrant.commands.plugin.expunge_request_reinstall\") +\n                  \" [N]: \"\n              )\n              result = result.to_s.downcase.strip\n              result = \"n\" if result.empty?\n              if ![\"y\", \"yes\", \"n\", \"no\"].include?(result)\n                result = nil\n                @env.ui.error(\"Please answer Y or N\")\n              else","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/plugin/command/expunge.rb#L24-L60","documentation":"`vagrant plugin expunge` accepts only flags (--force, --reinstall, --global-only) and no positional arguments. After parse_options, any leftover argv (argv.length > 0) raises Vagrant::Errors::CLIInvalidUsage with the help text. Expunge removes plugins, so Vagrant deliberately rejects accidental operands.","triggerScenarios":"Any positional token after the subcommand: `vagrant plugin expunge my-plugin`, `vagrant plugin expunge all`, or a stray word where a flag was intended (e.g. `force` instead of `--force`).","commonSituations":"Users assume expunge can target one plugin (it wipes all); muscle memory from `apt remove pkg`-style commands; scripts interpolating a variable that expands to a bare word.","solutions":["Run it bare: `vagrant plugin expunge` (add --force or --reinstall as flags).","To remove a single plugin, use `vagrant plugin uninstall <name>` instead.","Check `vagrant plugin expunge -h` for the supported flag set."],"exampleFix":"# before\nvagrant plugin expunge my-plugin\n# after\nvagrant plugin uninstall my-plugin    # expunge wipes ALL plugins, no operands allowed","handlingStrategy":"validation","validationCode":"pos = ARGV.reject { |a| a.start_with?('-') }\nabort 'vagrant plugin expunge takes no positional arguments' unless pos.empty?\nsystem('vagrant', 'plugin', 'expunge', '--force')","typeGuard":null,"tryCatchPattern":"begin\n  Vagrant::Environment.new.cli(['plugin', 'expunge'])\nrescue Vagrant::Errors::CLIInvalidUsage => e\n  warn e.message\n  exit 1\nend","preventionTips":["Remember expunge is all-or-nothing; uninstall targets single plugins.","Quote the whole command in scripts so stray variables do not become operands.","Snapshot plugins first: `vagrant plugin list > plugins.txt`."],"tags":["vagrant","plugin","cli","usage"],"backgroundTag":"invalid-cli-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}