hashicorp/vagrant · error

vagrant.provisioners.ansible.cannot_detect

Error message

vagrant.provisioners.ansible.cannot_detect

What it means

Error "vagrant.provisioners.ansible.cannot_detect" thrown in hashicorp/vagrant.

Source

Thrown at plugins/provisioners/ansible/provisioner/guest.rb:51

        # The compatibility mode checks are also performed here in order to fetch the
        # Ansible version information only once.
        #
        # Current limitations:
        #   - The installation of a specific Ansible version is only supported by
        #     the "pip" install_mode. Note that "pip" installation also takes place
        #     via a default command. If pip needs to be installed differently then
        #     the command can be overwritten by supplying "pip_install_cmd" in the
        #     config settings.
        #   - There is no absolute guarantee that the automated installation will replace
        #     a previous Ansible installation (although it works fine in many cases)
        #
        def check_and_install_ansible
          @logger.info("Checking for Ansible installation...")

          # If the guest cannot check if Ansible is installed,
          # print a warning and try to continue without any installation attempt...
          if !@machine.guest.capability?(:ansible_installed)
            @machine.ui.warn(I18n.t("vagrant.provisioners.ansible.cannot_detect"))
            return
          end

          # Try to install Ansible (if needed and requested)
          if config.install &&
             (config.version.to_s.to_sym == :latest ||
              !@machine.guest.capability(:ansible_installed, config.version))
            @machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing")
            @machine.guest.capability(:ansible_install, config.install_mode, config.version, config.pip_args, config.pip_install_cmd)
          end

          # This step will also fetch the Ansible version data into related instance variables
          set_and_check_compatibility_mode

          # Check if requested ansible version is available
          if (!config.version.empty? &&
              config.version.to_s.to_sym != :latest &&
              config.version != @gathered_version)

View on GitHub (pinned to 35f3160f4a)

When it happens

Trigger: Thrown at plugins/provisioners/ansible/provisioner/guest.rb:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/a5ee904d508e3187. Report an issue: GitHub.