hashicorp/vagrant · error · VagrantPlugins::CommunicatorWinRM::Errors::WinRMNotReady

The box is not able to report an address for WinRM to connec

Error message

The box is not able to report an address for WinRM to connect to yet.
WinRM cannot access this Vagrant environment. Please wait for the
Vagrant environment to be running and try again.

What it means

`vagrant winrm-config` needs WinRM connection details; CommunicatorWinRM::Helper.winrm_info(machine) returned nil, so no host/port for WinRM could be determined. Like ssh-config's SSHNotReady, this is machine state: the box cannot yet report an address for WinRM, typically because it is not booted or lacks a forwarded 5985 port / reachable IP.

Source

Thrown at plugins/commands/winrm_config/command.rb:41

        options = {}

        opts = OptionParser.new do |o|
          o.banner = "Usage: vagrant winrm-config [options] [name|id]"
          o.separator ""
          o.separator "Options:"
          o.separator ""

          o.on("--host NAME", "Name the host for the config") do |h|
            options[:host] = h
          end
        end

        argv = parse_options(opts)
        return if !argv

        with_target_vms(argv) do |machine|
          winrm_info = CommunicatorWinRM::Helper.winrm_info(machine)
          raise Vagrant::Errors::WinRMNotRead if winrm_info.nil?

          rdp_info = get_rdp_info(machine) || {}

          variables = {
            host_key: options[:host] || machine.name || "vagrant",
            rdp_host: rdp_info[:host] || winrm_info[:host],
            rdp_port: rdp_info[:port],
            rdp_user: rdp_info[:username],
            rdp_pass: rdp_info[:password],
            winrm_host: winrm_info[:host],
            winrm_port: winrm_info[:port],
            winrm_user: machine.config.winrm.username,
            winrm_password: machine.config.winrm.password
          }

          template = "commands/winrm_config/config"
          config = Vagrant::Util::TemplateRenderer.render(template, variables)
          machine.ui.machine("winrm-config", config)

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Bring the machine fully up first (`vagrant up`), verify WinRM answers (e.g. `vagrant port` shows the 5985 mapping), then retry
  2. Enable WinRM in the Vagrantfile: `config.vm.communicator = 'winrm'` plus a forwarded port for guest 5985
  3. If WinRM is slow to start on the guest, retry winrm-config after boot completes

Example fix

# before
Vagrant.configure('2') do |config|
  config.vm.box = 'windows-2019'
end
# vagrant winrm-config  ->  WinRMNotRead

# after
Vagrant.configure('2') do |config|
  config.vm.box = 'windows-2019'
  config.vm.communicator = 'winrm'
  config.vm.network 'forwarded_port', guest: 5985, host: 55985, id: 'winrm'
end
Defensive patterns

Strategy: retry

Validate before calling

state = machine.state.id
abort "machine is '#{state}'; run vagrant up first" unless state == 'running'
info = CommunicatorWinRM::Helper.winrm_info(machine)

Try / catch

attempts = 0
begin
  CommunicatorWinRM::Helper.winrm_info(machine) or raise Vagrant::Errors::WinRMNotRead
rescue Vagrant::Errors::WinRMNotRead
  attempts += 1
  retry if attempts < 30  # WinRM may still be starting on the guest
end

Prevention

When it happens

Trigger: Running `vagrant winrm-config` before the machine is up; a Windows box with no WinRM forwarded port and no private-network IP; communicator/address resolution failing so winrm_info has no address to return.

Common situations: Windows guests that take minutes to boot and start WinRM; Vagrantfiles missing `config.vm.communicator = 'winrm'` and the 5985 forwarded port; scripts generating winrm config for config-management tools right after `vagrant up` returns.

Related errors


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