{"record":{"id":"08447d89d6851f4e","repo":"hashicorp/vagrant","slug":"vagrant-was-unable-to-automatically-detect-the-ip","errorCode":null,"errorMessage":"Vagrant was unable to automatically detect the IP address of the\nrunning machine to use as the policy server address. Please specify\nthe policy server address manually, or verify that the networks are\nconfigured properly internally.","messagePattern":"Vagrant was unable to automatically detect the IP address of the\nrunning machine to use as the policy server address\\. Please specify\nthe policy server address manually, or verify that the networks are\nconfigured properly internally\\.","errorType":"exception","errorClass":"Vagrant::Errors.CFEngineCantAutodetectIP","httpStatus":null,"severity":"error","filePath":"plugins/provisioners/cfengine/provisioner.rb","lineNumber":90,"sourceCode":"      def cfagent_extra_args\n        return \"\" if !@config.extra_agent_args\n        return \" #{@config.extra_agent_args}\"\n      end\n\n      # This handles checking if the CFEngine installation needs to\n      # be bootstrapped, and bootstraps if it does.\n      def handle_cfengine_bootstrap\n        @logger.info(\"Bootstrapping CFEngine...\")\n        if !@machine.guest.capability(:cfengine_needs_bootstrap, @config)\n          @machine.ui.info(I18n.t(\"vagrant.cfengine_no_bootstrap\"))\n          return\n        end\n\n        # Needs bootstrap, let's determine the parameters\n        policy_server_address = @config.policy_server_address\n        if !policy_server_address\n          policy_server_address = @machine.guest.capability(:read_ip_address)\n          raise Vagrant::Errors::CFEngineCantAutodetectIP if !policy_server_address\n          @machine.ui.info(I18n.t(\"vagrant.cfengine_detected_ip\", address: policy_server_address))\n        end\n\n        @machine.ui.info(I18n.t(\"vagrant.cfengine_bootstrapping\",\n                                policy_server: policy_server_address))\n        result = cfagent(\"--bootstrap #{policy_server_address}\", error_check: false)\n        raise Vagrant::Errors::CFEngineBootstrapFailed if result != 0\n\n        # Policy hubs need to do additional things before they're ready\n        # to accept agents. Force that run now...\n        if @config.am_policy_hub\n          @machine.ui.info(I18n.t(\"vagrant.cfengine_bootstrapping_policy_hub\"))\n          cfagent(\"-KI -f /var/cfengine/masterfiles/failsafe.cf#{cfagent_classes_args}\")\n          cfagent(\"-KI #{cfagent_classes_args}#{cfagent_extra_args}\")\n        end\n      end\n\n      # This handles verifying the CFEngine installation, installing it","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/provisioners/cfengine/provisioner.rb#L72-L108","documentation":"Raised by the CFEngine provisioner's handle_cfengine_bootstrap when `policy_server_address` is not set in the Vagrantfile and the guest's `read_ip_address` capability fails to auto-detect an IP (returns nil/false). Vagrant needs the policy server address to run `cf-agent --bootstrap`, so it aborts instead of guessing. The error means either the guest OS lacks an IP-detection capability implementation or the detection command failed inside the box.","triggerScenarios":"Provisioning with `config.vm.provision \"cfengine\"` while `cfengine.policy_server_address` is unset, and `@machine.guest.capability(:read_ip_address)` returning nil because the guest has no capability implementation for that OS or the underlying detection command (ip/ifconfig parsing) fails.","commonSituations":"Using an exotic or minimal guest box whose OS has no read_ip_address capability plugin; NAT-only networking where the internal interface lookup fails; boxes missing `iproute2`/`ifconfig`; DHCP not yet finished when the capability runs.","solutions":["Set the address explicitly in the Vagrantfile: `cfengine.policy_server_address = \"10.0.2.2\"` (or your hub's IP)","Verify networking inside the guest: `vagrant ssh` then `ip addr` / `ifconfig` to confirm an address is detectable","Install missing network tools in the guest (iproute2 or net-tools) and re-run `vagrant provision`","Switch to a box that fully supports Vagrant guest capabilities for your OS family"],"exampleFix":"# Vagrantfile - before\nconfig.vm.provision \"cfengine\" do |cfengine|\n  cfengine.am_policy_hub = true\nend\n\n# Vagrantfile - after\nconfig.vm.provision \"cfengine\" do |cfengine|\n  cfengine.am_policy_hub = true\n  cfengine.policy_server_address = \"10.0.2.2\"\nend","handlingStrategy":"validation","validationCode":"# Vagrantfile: never rely on auto-detection in automation\nconfig.vm.provision \"cfengine\" do |cfengine|\n  cfengine.policy_server_address = ENV.fetch(\"CFENGINE_POLICY_SERVER\", \"10.0.2.2\")\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set cfengine.policy_server_address explicitly in Vagrantfiles used by CI or other automation","Confirm the guest box supports the read_ip_address capability before relying on auto-detection","Boot the VM once and check `ip addr` inside the guest before adding the cfengine provisioner"],"tags":["cfengine","provisioning","vagrant","network","ip-detection"],"backgroundTag":"ip-address-detection-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}