hashicorp/vagrant · error · Vagrant::Errors::WSLVagrantVersionMismatch

Vagrant cannot currently enable access to manage machines wi

Error message

Vagrant cannot currently enable access to manage machines within the Windows
environment because the version of Vagrant installed on Windows does not
match this version of Vagrant running within the Windows Subsystem for Linux.
Please ensure both installation of Vagrant are the same. If you do not want
update your Vagrant installations you can disable Windows access by unsetting
the `VAGRANT_WSL_ACCESS_WINDOWS_USER` environment variable.

  Windows Vagrant version: %{windows_version}
  Windows Subsystem for Linux Vagrant version: %{wsl_version}

What it means

When Windows interop is enabled (VAGRANT_WSL_ACCESS_WINDOWS_USER set), Vagrant executes `vagrant.exe --version` and compares the parsed version string against the Linux-side Vagrant::VERSION (wsl_validate_matching_vagrant_versions! in lib/vagrant/util/platform.rb). Any mismatch — or a failed/unparsable version check reported as 'unknown' — raises WSLVagrantVersionMismatch with both versions.

Source

Thrown at lib/vagrant/util/platform.rb:708

          end
          @_wsl_windows_appdata_local
        end

        # Confirm Vagrant versions installed within the WSL and the Windows system
        # are the same. Raise error if they do not match.
        def wsl_validate_matching_vagrant_versions!
          valid = false
          if Util::Which.which("vagrant.exe")
            result = Util::Subprocess.execute("vagrant.exe", "--version")
            if result.exit_code == 0
              windows_version = result.stdout.match(/Vagrant (?<version>[\w.-]+)/)
              if windows_version
                windows_version = windows_version[:version].strip
                valid = windows_version == Vagrant::VERSION
              end
            end
            if !valid
              raise Vagrant::Errors::WSLVagrantVersionMismatch,
                wsl_version: Vagrant::VERSION,
                windows_version: windows_version || "unknown"
            end
          end
        end

        # systemd is in use
        def systemd?
          if !defined?(@_systemd)
            if !windows?
              result = Vagrant::Util::Subprocess.execute("ps", "-o", "comm=", "1")
              @_systemd = result.stdout.chomp == "systemd"
            else
              @_systemd = false
            end
          end
          @_systemd
        end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Align both installs to the exact same version: update the Windows installer and the WSL-side package together
  2. If you do not need Windows access, unset VAGRANT_WSL_ACCESS_WINDOWS_USER — the validation is skipped entirely
  3. Verify both sides: `vagrant --version` in WSL and `vagrant.exe --version` on Windows

Example fix

# before
export VAGRANT_WSL_ACCESS_WINDOWS_USER=1   # versions differ -> error

# after: align versions, keep access on
# (Windows) winget upgrade Hashicorp.Vagrant
# (WSL)    update to the matching version, then:
export VAGRANT_WSL_ACCESS_WINDOWS_USER=1
Defensive patterns

Strategy: validation

Validate before calling

require 'vagrant'

def wsl_versions_match?
  out = `vagrant.exe --version 2>/dev/null`
  m = out.match(/Vagrant (\S+)/)
  !!(m && m[1].strip == Vagrant::VERSION)
end

ENV.delete('VAGRANT_WSL_ACCESS_WINDOWS_USER') unless wsl_versions_match?

Try / catch

begin
  Vagrant::Util::Platform.wsl_validate_matching_vagrant_versions!
rescue Vagrant::Errors::WSLVagrantVersionMismatch => e
  warn e.message
  ENV.delete('VAGRANT_WSL_ACCESS_WINDOWS_USER') # degrade gracefully
end

Prevention

When it happens

Trigger: Enabling Windows access from WSL while the Vagrant installed on Windows (vagrant.exe found on PATH) is older or newer than the one inside WSL; vagrant.exe present but its --version output cannot be parsed (windows_version nil → 'unknown').

Common situations: Updating Vagrant via installer/winget on Windows but not the package inside WSL (or vice versa); WSL PATH resolving to a different Windows install.

Related errors


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