{"record":{"id":"ffcdf6cdc8c6494e","repo":"hashicorp/vagrant","slug":"a-vm-by-the-name-of-name-was-not-found-ffcdf6","errorCode":null,"errorMessage":"A VM by the name of %{name} was not found.","messagePattern":"A VM by the name of %(.+?) was not found\\.","errorType":"exception","errorClass":"Vagrant::Errors::VMNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/vagrant/plugin/v2/command.rb","lineNumber":208,"sourceCode":"              if pattern = name[/^\\/(.+?)\\/$/, 1]\n                @logger.debug(\"Finding machines that match regex: #{pattern}\")\n\n                # This is a regular expression name, so we convert to a regular\n                # expression and allow that sort of matching.\n                regex = Regexp.new(pattern)\n\n                @env.machine_names.each do |machine_name|\n                  if machine_name =~ regex\n                    machines << get_machine.call(machine_name)\n                  end\n                end\n\n                raise Errors::VMNoMatchError if machines.empty?\n              else\n                # String name, just look for a specific VM\n                @logger.debug(\"Finding machine that match name: #{name}\")\n                machines << get_machine.call(name.to_sym)\n                raise Errors::VMNotFoundError, name: name if !machines[0]\n              end\n            end\n          else\n            # No name was given, so we return every VM in the order\n            # configured.\n            @logger.debug(\"Loading all machines...\")\n            machines = @env.machine_names.map do |machine_name|\n              get_machine.call(machine_name)\n            end\n          end\n\n          @logger.debug(\"have machine list to process\")\n\n          # Make sure we're only working with one VM if single target\n          if options[:single_target] && machines.length != 1\n            @logger.debug(\"Using primary machine since single target\")\n            primary_name = @env.primary_machine_name\n            raise Errors::MultiVMTargetRequired if !primary_name","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/plugin/v2/command.rb#L190-L226","documentation":"A plain machine name given to a v2 command resolved to no machine — get_machine.call(name.to_sym) returned nothing and the guard at lib/vagrant/plugin/v2/command.rb:208 raised. A name resolves only if it is defined in the local Vagrantfile's config.vm.define blocks or exists as an active/index machine; otherwise it is 'not found'.","triggerScenarios":"`vagrant ssh db` where the Vagrantfile defines only :web; using an expired global-status ID as if it were a name; a machine defined in a different project directory.","commonSituations":"Typos and case mismatches; commands copied from docs for a different Vagrantfile; renaming vm.define blocks without updating wrapper scripts.","solutions":["Run `vagrant status` to list the machine names valid for this environment","For non-local machines, get a fresh ID from `vagrant global-status` and use that","If the machine should exist locally, add the missing config.vm.define block to the Vagrantfile"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"valid = env.machine_names.map(&:to_s)\nknown_ids = env.machine_index.to_a.map { |e| e.name.to_s }\nabort \"unknown machine '#{name}'\" unless valid.include?(name) || known_ids.include?(name)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List valid names with `vagrant status` before targeting machines in scripts","Use full current IDs from `vagrant global-status` for non-local machines","Update scripts whenever config.vm.define names change"],"tags":["cli","machine-selection","not-found","v2-plugins"],"backgroundTag":"resource-not-found","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}