{"record":{"id":"516291354c6f1b77","repo":"hashicorp/vagrant","slug":"the-machine-with-the-name-name-was-not-found","errorCode":null,"errorMessage":"The machine with the name '%{name}' was not found configured for\nthis Vagrant environment.","messagePattern":"The machine with the name '%(.+?)' was not found configured for\nthis Vagrant environment\\.","errorType":"exception","errorClass":"Vagrant::Errors::MachineNotFound","httpStatus":null,"severity":"error","filePath":"lib/vagrant/vagrantfile.rb","lineNumber":122,"sourceCode":"    #   - config_errors: list of errors, if any\n    #   - config_warnings: list of warnings, if any\n    #   - provider_cls: class of the provider backing the machine\n    #   - provider_options: options for the provider\n    #\n    # @param [Symbol] name Name of the machine.\n    # @param [Symbol] provider The provider the machine should\n    #   be backed by (required for provider overrides).\n    # @param [BoxCollection] boxes BoxCollection to look up the\n    #   box Vagrantfile.\n    # @param [Pathname] data_path Machine data path\n    # @return [Hash<Symbol, Object>] Various configuration parameters for a\n    #   machine. See the main documentation body for more info.\n    def machine_config(name, provider, boxes, data_path=nil, validate_provider=true)\n      keys = @keys.dup\n\n      sub_machine = @config.vm.defined_vms[name]\n      if !sub_machine\n        raise Errors::MachineNotFound,\n          name: name, provider: provider\n      end\n\n      provider_plugin  = nil\n      provider_cls     = nil\n      provider_options = {}\n      box_formats      = nil\n      if provider != nil\n        provider_plugin  = Vagrant.plugin(\"2\").manager.providers[provider]\n        if !provider_plugin && validate_provider\n          providers  = Vagrant.plugin(\"2\").manager.providers.to_hash.keys\n          if providers\n            providers_str = providers.join(', ')\n          else\n            providers_str = \"N/A\"\n          end\n\n          if providers.include? provider.downcase","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/vagrantfile.rb#L104-L140","documentation":"Raised by VagrantFile#machine_config when the requested machine name has no entry in `config.vm.defined_vms`, i.e. no `config.vm.define \"<name>\"` block matches. Vagrant looks machines up strictly by the keys defined in the Vagrantfile; there is no default fallback name. The check is a plain hash lookup on the exact (case-sensitive) name.","triggerScenarios":"Any command or API call that targets a named machine - `vagrant up <name>`, `vagrant ssh <name>`, `vagrant destroy <name>`, or Environment#machine / VagrantFile#machine_config - where `@config.vm.defined_vms[name]` is nil.","commonSituations":"Typo or wrong casing in the machine name; running the command in the wrong directory (different or no Vagrantfile); a define block inside an `if` or loop that did not execute; copying a command from another project's docs.","solutions":["Run `vagrant status` to list the machines actually defined in this environment","Fix the name/case - names are exact strings from `config.vm.define`","Make sure you are in the directory that contains the Vagrantfile defining the machine","If the define block is conditional, verify the condition actually evaluates truthily"],"exampleFix":"# before\nvagrant ssh webb   # typo; only web and db are defined\n\n# after\nvagrant status      # lists: web, db\nvagrant ssh web","handlingStrategy":"validation","validationCode":"# bash: assert the machine exists before targeting it\nvagrant status --machine-readable 2>/dev/null |\n  awk -F, '$3 != \"\" {print $3}' | sort -u |\n  grep -qx \"$MACHINE\" || { echo \"no such machine: $MACHINE (defined: $(vagrant status -s)\"; exit 1; }","typeGuard":"# Ruby: narrow to defined machine names before calling machine APIs\ndef machine_defined?(env, name)\n  env.vagrantfile.machine_names.include?(name.to_sym) # Vagrantfile#machine_names\nend","tryCatchPattern":"begin\n  machine = env.machine(name, :virtualbox)\nrescue Vagrant::Errors::MachineNotFound\n  warn \"defined machines: #{env.vagrantfile.machine_names.join(', ')}\"\n  raise\nend","preventionTips":["Derive machine names from `vagrant status --machine-readable` instead of hard-coding","Keep machine names short, lowercase, and stable in the Vagrantfile","Guard wrapper scripts with an existence check before `vagrant ssh <name>`","Run commands from the directory that owns the Vagrantfile"],"tags":["machine","vagrantfile","not-found","multi-machine"],"backgroundTag":"resource-not-found","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}