{"record":{"id":"da4e2fc6f7992c55","repo":"hashicorp/vagrant","slug":"chef-server-provisioning-requires-that-the-config","errorCode":null,"errorMessage":"Chef server provisioning requires that the `config.chef.validation_key_path` configuration\nbe set to a path on your local machine of the validation key used to register the\nVM with the chef server.","messagePattern":"Chef server provisioning requires that the `config\\.chef\\.validation_key_path` configuration\nbe set to a path on your local machine of the validation key used to register the\nVM with the chef server\\.","errorType":"exception","errorClass":"VagrantPlugins::Chef::Provisioner::Base::ChefError","httpStatus":null,"severity":"error","filePath":"plugins/provisioners/chef/provisioner/chef_client.rb","lineNumber":21,"sourceCode":"\nrequire 'pathname'\n\nrequire 'vagrant'\nrequire 'vagrant/util/presence'\nrequire 'vagrant/util/subprocess'\n\nrequire_relative \"base\"\n\nmodule VagrantPlugins\n  module Chef\n    module Provisioner\n      # This class implements provisioning via chef-client, allowing provisioning\n      # with a chef server.\n      class ChefClient < Base\n        include Vagrant::Util::Presence\n\n        def configure(root_config)\n          raise ChefError, :server_validation_key_required if @config.validation_key_path.nil?\n          raise ChefError, :server_validation_key_doesnt_exist if !File.file?(validation_key_path)\n          raise ChefError, :server_url_required if @config.chef_server_url.nil?\n        end\n\n        def provision\n          install_chef\n          verify_binary(chef_binary_path(\"chef-client\"))\n          chown_provisioning_folder\n          create_client_key_folder\n          upload_validation_key\n          upload_encrypted_data_bag_secret\n          setup_json\n          setup_server_config\n          run_chef_client\n          delete_encrypted_data_bag_secret\n        end\n\n        def cleanup","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/chef/provisioner/chef_client.rb#L3-L39","documentation":"Raised in ChefClient#configure during config validation: chef-client (server-based) provisioning registers the node with a Chef server using a validation key, and `config.chef.validation_key_path` is the only way to supply it. If the option is nil, provisioning aborts before anything touches the machine. This is a pure Vagrantfile configuration error.","triggerScenarios":"Declaring `config.vm.provision \"chef_client\"` (or any chef provisioner bound to a server) without setting `chef.validation_key_path` in the provisioner block.","commonSituations":"Copying a chef_solo Vagrantfile and changing only the provisioner name to chef_client; onboarding templates that omit server registration settings; assuming the ORG_VALIDATOR key from knife.rb is picked up automatically (it is not).","solutions":["Set the path to your org validator key: `chef.validation_key_path = \"keys/org-validator.pem\"` (relative to the Vagrantfile project root)","Use an absolute path if the key lives outside the project","Download the validation key from your Chef server (Chef Infra Server UI or hosted Chef: Administration > Reset Validation Key) if you do not have one"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"chef_client\" do |chef|\n  chef.chef_server_url = \"https://api.chef.io/organizations/myorg\"\nend\n\n# Vagrantfile - after\nconfig.vm.provision \"chef_client\" do |chef|\n  chef.chef_server_url = \"https://api.chef.io/organizations/myorg\"\n  chef.validation_key_path = \"keys/myorg-validator.pem\"\nend","handlingStrategy":"validation","validationCode":"# Vagrantfile: fail fast with your own message\nraise \"Set CHEF_VALIDATION_KEY_PATH\" if ENV[\"CHEF_VALIDATION_KEY_PATH\"].nil?\nconfig.vm.provision \"chef_client\" do |chef|\n  chef.validation_key_path = ENV[\"CHEF_VALIDATION_KEY_PATH\"]\nend","typeGuard":"def chef_client_config_valid?(chef)\n  !chef.validation_key_path.nil?\nend","tryCatchPattern":null,"preventionTips":["Use a project template that already wires validation_key_path, chef_server_url and validation_client_name together","Keep a rake task or pre-flight script that validates chef_server settings before `vagrant up`","Store the validator key path in an env var so missing keys fail with your own clear message"],"tags":["chef","chef-client","provisioning","vagrant","configuration"],"backgroundTag":"missing-required-config-option","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}