{"record":{"id":"5dce31ba293f92a9","repo":"hashicorp/vagrant","slug":"an-invalid-option-was-specified-the-help-for-this-5dce31","errorCode":null,"errorMessage":"An invalid option was specified. The help for this command\nis available below.\n\n%{help}","messagePattern":"An invalid option was specified\\. The help for this command\nis available below\\.\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidOptions","httpStatus":null,"severity":"error","filePath":"lib/vagrant/plugin/v2/command.rb","lineNumber":67,"sourceCode":"          ENV[\"POSIXLY_CORRECT\"] = nil\n\n          # Creating a shallow copy of the arguments so the OptionParser\n          # doesn't destroy the originals.\n          argv = @argv.dup\n\n          # Default opts to a blank optionparser if none is given\n          opts ||= Vagrant::OptionParser.new\n\n          # Add the help option, which must be on every command.\n          opts.on_tail(\"-h\", \"--help\", \"Print this help\") do\n            safe_puts(opts.help)\n            return nil\n          end\n\n          opts.parse!(argv)\n          return argv\n        rescue OptionParser::InvalidOption, OptionParser::MissingArgument, OptionParser::AmbiguousOption\n          raise Errors::CLIInvalidOptions, help: opts.help.chomp\n        end\n\n        # Yields a VM for each target VM for the command.\n        #\n        # This is a convenience method for easily implementing methods that\n        # take a target VM (in the case of multi-VM) or every VM if no\n        # specific VM name is specified.\n        #\n        # @param [String] name The name of the VM. Nil if every VM.\n        # @param [Hash] options Additional tweakable settings.\n        # @option options [Symbol] :provider The provider to back the\n        #   machines with. All machines will be backed with this\n        #   provider. If none is given, a sensible default is chosen.\n        # @option options [Boolean] :reverse If true, the resulting order\n        #   of machines is reversed.\n        # @option options [Boolean] :single_target If true, then an\n        #   exception will be raised if more than one target is found.\n        def with_target_vms(names=nil, options=nil)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/plugin/v2/command.rb#L49-L85","documentation":"Usage error from a v2 plugin command (which includes all modern built-in commands): OptionParser raised InvalidOption, MissingArgument, or AmbiguousOption while parsing argv, and parse_options converts it to CLIInvalidOptions with the command's help embedded as %{help} (lib/vagrant/plugin/v2/command.rb:67). It aborts the command before any machine is touched.","triggerScenarios":"`vagrant snapshot save` missing its mandatory name argument (MissingArgument); `vagrant up --provder=virtualbox` with a typo (InvalidOption); an ambiguous abbreviated long option (AmbiguousOption) — any v2 command whose opt_parser rejects the given argv.","commonSituations":"Typo'd long flags; forgetting the value for options like --provider; scripts written against a different Vagrant release whose flag set changed; abbreviating long options that are no longer unique.","solutions":["Re-run with `--help` to see the exact accepted syntax","Fix the typo or supply the missing option value","Confirm the option exists in your Vagrant version — flags changed across releases (check `vagrant <cmd> --help` output)"],"exampleFix":"# before\nvagrant up --provder=virtualbox\n\n# after\nvagrant up --provider=virtualbox","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  command.parse_options(argv)\nrescue Vagrant::Errors::CLIInvalidOptions => e\n  warn e.extra_data[:help] # reprint full usage for the caller\nend","preventionTips":["Spell out long options fully in scripts; avoid ambiguous abbreviations","Always provide values for options that take them (--provider virtualbox)","Pin the Vagrant version in CI so documented flags remain valid","Smoke-test scripted commands with --help after Vagrant upgrades"],"tags":["cli","options","usage","v2-plugins"],"backgroundTag":"invalid-command-line-argument","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}