{"record":{"id":"b4ced789fc227011","repo":"hashicorp/vagrant","slug":"vagrant-could-not-detect-chef-on-the-guest-even-a","errorCode":null,"errorMessage":"Vagrant could not detect Chef on the guest! Even after Vagrant\nattempted to install Chef, it could still not find Chef on the system.\nPlease make sure you are connected to the Internet and can access\nChef's package distribution servers. If you already have Chef\ninstalled on this guest, you can disable the automatic Chef detection\nby setting the 'install' option in the Chef configuration section of\nyour Vagrantfile:\n\n    chef.install = false","messagePattern":"Vagrant could not detect Chef on the guest! Even after Vagrant\nattempted to install Chef, it could still not find Chef on the system\\.\nPlease make sure you are connected to the Internet and can access\nChef's package distribution servers\\. If you already have Chef\ninstalled on this guest, you can disable the automatic Chef detection\nby setting the 'install' option in the Chef configuration section of\nyour Vagrantfile:\n\n    chef\\.install = false","errorType":"exception","errorClass":"VagrantPlugins::Chef::Provisioner::Base::ChefError","httpStatus":null,"severity":"error","filePath":"plugins/provisioners/chef/installer.rb","lineNumber":39,"sourceCode":"        # If the guest cannot check if Chef is installed, just exit printing a\n        # warning...\n        if !@machine.guest.capability?(:chef_installed)\n          @machine.ui.warn(I18n.t(\"vagrant.chef_cant_detect\"))\n          return\n        end\n\n        if !should_install_chef?\n          @machine.ui.info(I18n.t(\"vagrant.chef_already_installed\",\n            version: @version.to_s))\n          return\n        end\n\n        @machine.ui.detail(I18n.t(\"vagrant.chef_installing\",\n          version: @version.to_s))\n        @machine.guest.capability(:chef_install, @product, @version, @channel, @omnibus_url, @options)\n\n        if !@machine.guest.capability(:chef_installed, @product, @version)\n          raise Provisioner::Base::ChefError, :install_failed\n        end\n      end\n\n      # Determine if Chef should be installed. Chef is installed if the \"force\"\n      # option is given or if the guest does not have Chef installed at the\n      # proper version.\n      def should_install_chef?\n        @force || !@machine.guest.capability(:chef_installed, @product, @version)\n      end\n    end\n  end\nend\n","sourceCodeStart":21,"sourceCodeEnd":52,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/chef/installer.rb#L21-L52","documentation":"Raised by the Chef installer after it decided Chef was missing (or `force` was set), ran the guest `chef_install` capability, and the follow-up `chef_installed` capability check still reports the requested product/version is absent. The install attempt itself already streamed its output; this error only says the post-install verification failed. Typical root causes are network/package-repository failures inside the guest, unsupported distros, or a version string the verification check cannot satisfy.","triggerScenarios":"Calling any chef provisioner (chef_solo/chef_zero/chef_client) with `install` enabled (default true) where `should_install_chef?` is true, `@machine.guest.capability(:chef_install, ...)` runs, and `chef_installed` afterwards still returns false.","commonSituations":"Air-gapped or proxied environments where packagecloud/chef.io downloads fail inside the guest; unsupported or very new distro release with no install script; requested `version` string never matches what omnitruck installs; slow mirrors timing out.","solutions":["Scroll up to the installer output - it shows the actual download/package error from the guest","Verify guest egress: `vagrant ssh` then `curl -I https://omnitruck.chef.io` (or your proxy settings work)","If Chef really is preinstalled in the box, disable detection+install: `chef.install = false`","Pin a known-good product/version: `chef.product = \"chef\"` and `chef.version = \"17.10.0\"` instead of :latest"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"chef_solo\" do |chef|\n  chef.version = :latest\nend\n\n# Vagrantfile - after\nconfig.vm.provision \"chef_solo\" do |chef|\n  chef.install = false   # Chef already baked into the box\nend","handlingStrategy":"try-catch","validationCode":"# Vagrantfile: skip detection when the box already ships Chef\nif ENV[\"CHEF_PREINSTALLED\"]\n  chef.install = false\nend","typeGuard":null,"tryCatchPattern":"begin\n  env.cli(%w[up --provision])\nrescue Vagrant::Errors::VagrantError => e\n  if e.message.include?(\"could not detect Chef\")\n    retry_after_network_fix!\n  else\n    raise\n  end\nend","preventionTips":["Bake Chef into the base box and set chef.install = false for reproducible CI","Pin chef.product and chef.version instead of :latest so the installed/verified pair matches","Ensure the guest has working DNS/egress to omnitruck/packagecloud before first provision"],"tags":["chef","provisioning","vagrant","installation","network"],"backgroundTag":"package-installation-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}