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

Chef never successfully completed! Any errors should be visi

Error message

Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

What it means

Raised at the end of the chef_zero provisioner's convergence run, which uses the same loop as chef_solo/chef_client: stream output, treat exit 259 as reboot-and-continue, return on exit 0, otherwise re-run up to `config.attempts` times, then raise :no_convergence. chef_zero runs against a local in-memory Chef server, so failures are recipe/cookbook errors or local upload problems, visible in the output above.

Source

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

              opts = { error_check: false, elevated: true }
              exit_status = @machine.communicate.sudo(command, opts) do |type, data|
                # Output the data with the proper color based on the stream.
                color = type == :stdout ? :green : :red

                data = data.chomp
                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

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read the streamed output above - fix the first failing resource
  2. Confirm roles/data_bags/environments paths exist on host and are mounted: `chef.roles_path`, `chef.data_bags_path`, `chef.environments_path`
  3. If using encrypted data bags, verify `chef.encrypted_data_bag_secret_path` points at the real secret
  4. Set `chef.attempts = 3` to ride out transient package/network failures inside recipes

Example fix

# Vagrantfile - before
config.vm.provision "chef_zero" do |chef|
  chef.run_list = ["recipe[myapp]"]
end

# Vagrantfile - after
config.vm.provision "chef_zero" do |chef|
  chef.run_list = ["recipe[myapp]"]
  chef.data_bags_path = "data_bags"
  chef.encrypted_data_bag_secret_path = "secrets/databag_key"
end
Defensive patterns

Strategy: retry

Try / catch

begin
  env.cli(%w[provision])
rescue Vagrant::Errors::VagrantError => e
  if e.to_s.include?("never successfully completed") && Time.now.hour.between?(2, 4) # mirror maintenance window
    sleep 300; retry
  end
  raise
end

Prevention

When it happens

Trigger: chef-zero/solo-legacy run exiting non-zero on every attempt: recipe failures, missing data bags/roles/environments passed to the zero server, encrypted data bag secret issues, or cookbook dependency errors.

Common situations: Same as chef_solo plus: encrypted_data_bag_secret path wrong or secret missing so recipes fail on decryption; environments/roles referenced in run_list but not present in the configured paths; migrating from chef_solo with legacy_mode confusion.

Related errors


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