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 run_chef_solo in the chef_solo provisioner: identical convergence loop to chef_client (exit 259 = reboot and re-run, exit 0 = success, up to `config.attempts` iterations). Solo runs chef-solo against local cookbooks mounted from the host, so non-convergence means recipe failure, missing local cookbooks/roles/data bags, or bad solo.rb inputs - all visible in the streamed output above.

Source

Thrown at plugins/provisioners/chef/provisioner/chef_solo.rb:223

              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 chef-solo output above - fix the first reported resource or compile error
  2. Verify cookbook layout: `chef.cookbooks_path = "cookbooks"` must contain the cookbooks named in run_list
  3. Vendor dependencies first (berks vendor cookbooks) and point cookbooks_path at the vendored folder
  4. Set `chef.attempts = 3` for transient failures such as package mirror hiccups

Example fix

# Vagrantfile - before
chef.cookbooks_path = "../chef-repo/cookbooks"
chef.run_list = ["recipe[apache2]"]  # apache2 not in that folder

# Vagrantfile - after
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.run_list = ["recipe[apache2]"]   # berks vendor'd into ./cookbooks
Defensive patterns

Strategy: retry

Validate before calling

# Verify the run_list resolves against your local cookbooks before provisioning
recipes = chef.run_list.map { |r| r.split("[").last.split("]").first }
cookbooks = Dir.children("cookbooks")
missing = recipes.reject { |recipe_dir_name| cookbooks.include?(recipe_dir_name) }
abort "Missing cookbooks: #{missing.join(', ')}" unless missing.empty?

Try / catch

begin
  env.cli(%w[provision])
rescue Vagrant::Errors::VagrantError => e
  if e.to_s.include?("never successfully completed")
    dump_chef_log_and_fail!  # vagrant ssh -c 'cat /var/log/chef-solo.log'
  end
  raise
end

Prevention

When it happens

Trigger: chef-solo exiting non-zero on all attempts: recipe errors, `cookbooks_path` pointing at a folder without the needed cookbook, missing roles/environments/data bags, Ruby/Chef version mismatch inside the guest.

Common situations: cookbooks_path typo or folder not synced into guest; dependency cookbooks not vendored (no Berkshelf/Librarian step); role files referenced but roles_path unset; node attributes with wrong types causing compile errors.

Related errors


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