{"record":{"id":"e1bf37ede3fa4ed3","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-e1bf37","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/snapshot/command/root.rb","lineNumber":62,"sourceCode":"\n          @subcommands.register(:pop) do\n            require_relative \"pop\"\n            Pop\n          end\n        end\n\n        def execute\n          if @main_args.include?(\"-h\") || @main_args.include?(\"--help\")\n            # Print the help for all the commands.\n            @env.ui.info(help, prefix: false)\n            return 0\n          end\n\n          # If we reached this far then we must have a subcommand. If not,\n          # then we also just print the help and exit.\n          command_class = @subcommands.get(@sub_command.to_sym) if @sub_command\n          if !command_class || !@sub_command\n            raise Vagrant::Errors::CLIInvalidUsage,\n              help: help()\n          end\n          @logger.debug(\"Invoking command class: #{command_class} #{@sub_args.inspect}\")\n\n          # Initialize and execute the command class\n          command_class.new(@sub_args, @env).execute\n        end\n\n        # Prints the help out for this command\n        def help\n          opts = OptionParser.new do |opts|\n            opts.banner = \"Usage: vagrant snapshot <subcommand> [<args>]\"\n            opts.separator \"\"\n            opts.separator \"Available subcommands:\"\n\n            # Add the available subcommands as separators in order to print them\n            # out as well.\n            keys = []","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/snapshot/command/root.rb#L44-L80","documentation":"The `vagrant snapshot` command is a subcommand dispatcher (save, restore, list, delete). When the first non-option token is missing or does not name a registered subcommand, the root command raises CLIInvalidUsage and prints the full snapshot help. This happens before any machine is touched.","triggerScenarios":"`vagrant snapshot` with no subcommand; a misspelled subcommand like `vagrant snapshot del snap1` or `vagrant snapshot rm snap1`; a subcommand that exists in a newer Vagrant release than the one installed.","commonSituations":"Users coming from virsh/other tooling expecting `rm`/`remove`; scripts written against a different Vagrant version's subcommand set; muscle memory from `vagrant snapshot save` shortening to an invalid form.","solutions":["Run `vagrant snapshot -h` to list the valid subcommands for your version","Use the exact subcommand name, e.g. `vagrant snapshot delete snap1`","Upgrade Vagrant if documentation describes a subcommand your installed version lacks"],"exampleFix":"# before\nvagrant snapshot del snap1\n\n# after\nvagrant snapshot delete snap1","handlingStrategy":"validation","validationCode":"valid = %w[save restore list delete]\nsub = ARGV[0]\nabort \"unknown subcommand #{sub}; valid: #{valid.join(', ')}\" unless valid.include?(sub)\nsystem('vagrant', 'snapshot', *ARGV)","typeGuard":null,"tryCatchPattern":"begin\n  VagrantPlugins::CommandSnapshot::Command.new(argv, env).execute\nrescue Vagrant::Errors::CLIInvalidUsage => e\n  warn e.extra_data[:help]\n  exit 1\nend","preventionTips":["Validate the subcommand against the installed version's help output before invoking","Pin the Vagrant version in CI so subcommand sets do not shift","Use `vagrant snapshot -h` as the source of truth when writing wrappers"],"tags":["vagrant","snapshot","cli","usage","subcommand"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}