{"record":{"id":"74879d54bddb9e9f","repo":"hashicorp/vagrant","slug":"chef-never-successfully-completed-any-errors-shou-74879d","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_zero.rb","lineNumber":102,"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 verify_shared_folders(folders)\n          folders.each do |folder|\n            @logger.debug(\"Checking for shared folder: #{folder}\")\n            if !@machine.communicate.test(\"test -d #{folder}\", sudo: true)\n              raise ChefError, :missing_shared_folders\n            end\n          end\n        end\n\n        protected\n\n        # Extracts only the remote paths from a list of folders\n        def guest_paths(folders)\n          folders.map { |parts| parts[2] }\n        end\n      end","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/chef/provisioner/chef_zero.rb#L84-L120","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the streamed output above - fix the first failing resource","Confirm roles/data_bags/environments paths exist on host and are mounted: `chef.roles_path`, `chef.data_bags_path`, `chef.environments_path`","If using encrypted data bags, verify `chef.encrypted_data_bag_secret_path` points at the real secret","Set `chef.attempts = 3` to ride out transient package/network failures inside recipes"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"chef_zero\" do |chef|\n  chef.run_list = [\"recipe[myapp]\"]\nend\n\n# Vagrantfile - after\nconfig.vm.provision \"chef_zero\" do |chef|\n  chef.run_list = [\"recipe[myapp]\"]\n  chef.data_bags_path = \"data_bags\"\n  chef.encrypted_data_bag_secret_path = \"secrets/databag_key\"\nend","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  env.cli(%w[provision])\nrescue Vagrant::Errors::VagrantError => e\n  if e.to_s.include?(\"never successfully completed\") && Time.now.hour.between?(2, 4) # mirror maintenance window\n    sleep 300; retry\n  end\n  raise\nend","preventionTips":["Validate data bags locally: `knife data bag from file` against a chef-zero server in CI before Vagrant runs them","Keep encrypted_data_bag_secret_path under version-controlled provisioning config (gitignored secret file itself)","Set chef.attempts so mirror hiccups self-heal instead of failing the build"],"tags":["chef","chef-zero","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"}