puppetlabs/puppet · error · Puppet::ParseError

Failed to execute generator

Error message

Failed to execute generator %{generator}: %{detail}

What it means

The generator executed via Puppet::Util::Execution exited non-zero (failonfail: true); the Puppet::ExecutionFailure detail is rescued and re-raised as a parse error.

Solutions

  1. Make the generator exit 0 on success
  2. Check the command path and arguments passed to generate()
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at lib/puppet/parser/functions/generate.rb:37 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/9bc5ceaecaff22fa. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/parser/functions/generate.rb:37

  if Puppet::Util::Platform.windows?
    valid = args[0] =~ %r{^[a-z]:(?:[/\\][-.~\w]+)+$}i
  else
    valid = args[0] =~ %r{^[-/\w.+]+$}
  end

  unless valid
    raise Puppet::ParseError, _("Generators can only contain alphanumerics, file separators, and dashes")
  end

  if args[0] =~ /\.\./
    raise Puppet::ParseError, _("Can not use generators with '..' in them.")
  end

  begin
    dir = File.dirname(args[0])
    Puppet::Util::Execution.execute(args, failonfail: true, combine: true, cwd: dir).to_str
  rescue Puppet::ExecutionFailure => detail
    raise Puppet::ParseError, _("Failed to execute generator %{generator}: %{detail}") % { generator: args[0], detail: detail }, detail.backtrace
  end
end

View on GitHub (pinned to e227c27540)