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

The executable '%{file}' Vagrant is trying to run was not fo

Error message

The executable '%{file}' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

What it means

The POSIX twin of CommandUnavailableWindows: Subprocess#initialize raises CommandUnavailable when Which.which cannot resolve the command's first token on a non-Windows host. The %{file} placeholder names the missing executable.

Source

Thrown at lib/vagrant/util/subprocess.rb:34

    # Execute a command in a subprocess, gathering the results and
    # exit status.
    #
    # This class also allows you to read the data as it is outputted
    # from the subprocess in real time, by simply passing a block to
    # the execute method.
    class Subprocess
      # Convenience method for executing a method.
      def self.execute(*command, &block)
        new(*command).execute(&block)
      end

      def initialize(*command)
        @options = command.last.is_a?(Hash) ? command.pop : {}
        @command = command.dup
        @command[0] = Which.which(@command[0]) if !File.file?(@command[0])
        if !@command[0]
          raise Errors::CommandUnavailableWindows, file: command[0] if Platform.windows?
          raise Errors::CommandUnavailable, file: command[0]
        end

        @logger  = Log4r::Logger.new("vagrant::util::subprocess")
      end

      # @return [TrueClass, FalseClass] subprocess is currently running
      def running?
        !!(@process && @process.alive?)
      end

      # Stop the subprocess if running
      #
      # @return [TrueClass] FalseClass] true if process was running and stopped
      def stop
        if @process && @process.alive?
          @process.stop
          true
        else

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Install the package providing %{file} via the distro package manager (apt/dnf/brew)
  2. Fix PATH if it is installed but not visible — check login vs non-login shell differences under cron/CI
  3. Pass an absolute path as argv[0], since Subprocess skips Which resolution for existing file paths

Example fix

# before
$ vagrant up   # CommandUnavailable: 'genisoimage'

# after (Debian/Ubuntu)
$ sudo apt-get install -y genisoimage
$ vagrant up
Defensive patterns

Strategy: validation

Validate before calling

require 'vagrant/util/which'

tool = 'curl'
path = Vagrant::Util::Which.which(tool)
abort "#{tool} not on PATH; install it (apt/dnf/brew)" unless path

Try / catch

begin
  Vagrant::Util::Subprocess.execute('curl', '--version')
rescue Vagrant::Errors::CommandUnavailable => e
  abort "install #{e.extra_data[:file]} via your package manager"
end

Prevention

When it happens

Trigger: Subprocess.execute('curl'/'nfsd'/'genisoimage'/...) on Linux/macOS where the binary is absent: minimal containers, stripped VM images, missing optional packages (nfs-utils, genisoimage, curl).

Common situations: Running Vagrant inside slim Docker images without curl; hosts lacking an NFS server for private_network; missing ISO tools for cloud-init seeds.

Related errors


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