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_client: Vagrant streams `chef-client` output live, treats exit 259 as 'chef requested a reboot' (waits and re-runs), returns immediately on exit 0, and re-runs up to `@config.attempts` times. If no attempt exits 0, no_convergence is raised - meaning the Chef run itself failed (recipe/dependency/server errors) and the details are in the output already printed. This error never appears without accompanying Chef output above it.
Source
Thrown at plugins/provisioners/chef/provisioner/chef_client.rb:118
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 validation_key_path
File.expand_path(@config.validation_key_path, @machine.env.root_path)
end
def guest_client_key_path
if !@config.client_key_path.nil?
return @config.client_key_path
end
if windows?
"C:/chef/client.pem"
else
"/etc/chef/client.pem"
end
end
View on GitHub (pinned to 35f3160f4a)
Solutions
- Read the streamed chef-client output above the error - look for the first 'Error Resolving Exception' / resource failure
- Fix the failing recipe/dependency in the run_list, or correct `chef.run_list` / `chef.environment` in the Vagrantfile
- For transient issues, allow retries: `chef.attempts = 3`
- If output shows 401/403, fix the validation key / validation_client_name / chef_server_url trio
Example fix
# Vagrantfile - before config.vm.provision "chef_client" do |chef| chef.run_list = ["recipe[myapp::install]"] end # Vagrantfile - after config.vm.provision "chef_client" do |chef| chef.run_list = ["recipe[myapp::install]"] chef.attempts = 3 # retry flaky convergence instead of failing on first run end
Defensive patterns
Strategy: retry
Try / catch
attempts = 0
begin
env.cli(%w[provision])
rescue Vagrant::Errors::VagrantError => e
attempts += 1
if e.to_s.include?("never successfully completed") && attempts < 3
sleep 30
retry
end
raise
end Prevention
- Set chef.attempts = 3 so Vagrant retries convergence for transient recipe failures
- Run `knife cookbook test` / `cookstyle` on cookbooks before provisioning
- Watch the streamed chef-client output on failure - the first resource error is the real cause, not the raise
When it happens
Trigger: chef-client exiting non-zero on every one of `config.attempts` runs: failed resources, missing cookbooks/roles on the server, node registration (401/403 against chef_server_url), sandboxed reboot loops exiting 259 repeatedly, or recipe compile errors.
Common situations: Broken or untested cookbooks in the run_list; wrong run_list/environment in the Vagrantfile; validation key rejected by the server (401); node name collision; guest clock skew breaking TLS/auth; `attempts` left at default 1 for flaky recipes.
Related errors
- This Vagrant environment has specified that it requires the
- Chef server provisioning requires that the `config.chef.vali
- The validation key set for `config.chef.validation_key_path`
- Chef server provisioning requires that the `config.chef.chef
- Chef never successfully completed! Any errors should be visi
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/e02294290069e973.
Report an issue: GitHub.