{"record":{"id":"e02294290069e973","repo":"hashicorp/vagrant","slug":"chef-never-successfully-completed-any-errors-shou","errorCode":null,"errorMessage":"Chef never successfully completed! Any errors should be visible in the\noutput above. Please fix your recipes so that they properly complete.","messagePattern":"Chef never successfully completed! Any errors should be visible in the\noutput above\\. Please fix your recipes so that they properly complete\\.","errorType":"exception","errorClass":"VagrantPlugins::Chef::Provisioner::Base::ChefError","httpStatus":null,"severity":"error","filePath":"plugins/provisioners/chef/provisioner/chef_client.rb","lineNumber":118,"sourceCode":"\n              opts = { error_check: false, elevated: true }\n              exit_status = @machine.communicate.sudo(command, opts) do |type, data|\n                # Output the data with the proper color based on the stream.\n                color = type == :stdout ? :green : :red\n\n                data = data.chomp\n                next if data.empty?\n\n                @machine.ui.info(data, color: color)\n              end\n\n              # There is no need to run Chef again if it converges\n              return if exit_status == 0\n            end\n          end\n\n          # If we reached this point then Chef never converged! Error.\n          raise ChefError, :no_convergence\n        end\n\n        def validation_key_path\n          File.expand_path(@config.validation_key_path, @machine.env.root_path)\n        end\n\n        def guest_client_key_path\n          if !@config.client_key_path.nil?\n            return @config.client_key_path\n          end\n\n          if windows?\n            \"C:/chef/client.pem\"\n          else\n            \"/etc/chef/client.pem\"\n          end\n        end\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/chef/provisioner/chef_client.rb#L100-L136","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"chef_client\" do |chef|\n  chef.run_list = [\"recipe[myapp::install]\"]\nend\n\n# Vagrantfile - after\nconfig.vm.provision \"chef_client\" do |chef|\n  chef.run_list = [\"recipe[myapp::install]\"]\n  chef.attempts = 3  # retry flaky convergence instead of failing on first run\nend","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"attempts = 0\nbegin\n  env.cli(%w[provision])\nrescue Vagrant::Errors::VagrantError => e\n  attempts += 1\n  if e.to_s.include?(\"never successfully completed\") && attempts < 3\n    sleep 30\n    retry\n  end\n  raise\nend","preventionTips":["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"],"tags":["chef","chef-client","provisioning","vagrant","convergence"],"backgroundTag":"chef-convergence-failure","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}