puppetlabs/puppet · error · ArgumentError

Could not find command

Error message

Could not find command '%{exe}'

What it means

Windows exec provider: the absolute path given for the command does not exist (Puppet::FileSystem.exist? is false), so the command cannot run.

Solutions

  1. Correct the absolute path (mind drive letters and separators)
  2. Install the missing executable
  3. If not absolute, add its directory to the 'path' setting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/provider/exec/windows.rb:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/ed14638595515a9b. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/provider/exec/windows.rb:41

    **Note on PowerShell scripts:** PowerShell's default `restricted`
    execution policy doesn't allow it to run saved scripts. To run PowerShell
    scripts, specify the `remotesigned` execution policy as part of the
    command:

        exec { 'test':
          path    => 'C:/Windows/System32/WindowsPowerShell/v1.0',
          command => 'powershell -executionpolicy remotesigned -file C:/test.ps1',
        }

  EOT

  # Verify that we have the executable
  def checkexe(command)
    exe = extractexe(command)

    if absolute_path?(exe)
      if !Puppet::FileSystem.exist?(exe)
        raise ArgumentError, _("Could not find command '%{exe}'") % { exe: exe }
      elsif !File.file?(exe)
        raise ArgumentError, _("'%{exe}' is a %{klass}, not a file") % { exe: exe, klass: File.ftype(exe) }
      end

      return
    end

    if resource[:path]
      Puppet::Util.withenv('PATH' => resource[:path].join(File::PATH_SEPARATOR)) do
        return if which(exe)
      end
    end

    raise ArgumentError, _("Could not find command '%{exe}'") % { exe: exe }
  end
end

View on GitHub (pinned to e227c27540)