hashicorp/vagrant · error · VagrantPlugins::Chef::Provisioner::Base::ChefError

Shared folders that Chef requires are missing on the virtual

Error message

Shared folders that Chef requires are missing on the virtual machine.
This is usually due to configuration changing after already booting the
machine. The fix is to run a `vagrant reload` so that the proper shared
folders will be prepared and mounted on the VM.

What it means

Raised by verify_shared_folders in the chef_zero provisioner: every host folder Chef needs (cookbooks, roles, nodes, data bags, environments) is mounted into the guest and probed with `test -d <path>` over sudo. Any missing guest path aborts provisioning with the canonical fix: `vagrant reload` re-prepares the mounts. chef_zero serves those mounted files from a local server, so absence is fatal before any chef run starts.

Source

Thrown at plugins/provisioners/chef/provisioner/chef_zero.rb:109

                next if data.empty?

                @machine.ui.info(data, color: color)
              end

              # There is no need to run Chef again if it converges
              return if exit_status == 0
            end
          end

          # If we reached this point then Chef never converged! Error.
          raise ChefError, :no_convergence
        end

        def verify_shared_folders(folders)
          folders.each do |folder|
            @logger.debug("Checking for shared folder: #{folder}")
            if !@machine.communicate.test("test -d #{folder}", sudo: true)
              raise ChefError, :missing_shared_folders
            end
          end
        end

        protected

        # Extracts only the remote paths from a list of folders
        def guest_paths(folders)
          folders.map { |parts| parts[2] }
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Run `vagrant reload --provision` to rebuild and remount the synced folders
  2. Repair guest additions (vagrant-vbguest plugin or matching open-vm-tools) if mounts fail every boot
  3. Verify inside the guest that each configured path exists: `vagrant ssh -c 'ls /tmp/vagrant-chef-*/'`
  4. Simplify/shorten host-side folder paths if the mount itself is failing

Example fix

# Terminal - before (changed chef.*_path settings)
vagrant provision   # -> missing_shared_folders

# Terminal - after
vagrant reload --provision
Defensive patterns

Strategy: validation

Validate before calling

# Pre-flight on the host: all chef_zero paths must exist and be shareable
%w[cookbooks data_bags roles environments].each do |dir|
  warn "#{dir} missing - chef_zero mount will fail" unless Dir.exist?(dir)
end

Prevention

When it happens

Trigger: Running chef_zero provisioning when the synced folder set changed after the machine booted, or when mounting failed at boot (guest tools missing/mismatched), so one or more Chef folders do not exist inside the guest.

Common situations: Added/renamed `chef.data_bags_path` then used `vagrant provision` instead of reload; Guest Additions broken after guest kernel upgrade; long path or special characters breaking the mount; config.vm.synced_folder disabling /vagrant.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/d8d942156cb49526. Report an issue: GitHub.