puppetlabs/puppet · error · Puppet::Error
%{message} on node %{node}
Error message
%{message} on node %{node} What it means
Puppet::Parser::Compiler.compile wraps the whole catalog compile: any exception that is not a Puppet::ParseErrorWithIssue (e.g. a raw Ruby error raised inside a custom function, fact or Ruby template) is caught, logged with its own class and backtrace via Puppet.log_exception, then re-raised as Puppet::Error with 'on node <certname>' appended. This is a context wrapper, not a root cause.
Source
Thrown at lib/puppet/parser/compiler.rb:44
errors = node.environment.validation_errors
unless errors.empty?
errors.each { |e| Puppet.err(e) } if errors.size > 1
errmsg = [
_("Compilation has been halted because: %{error}") % { error: errors.first },
_("For more information, see https://puppet.com/docs/puppet/latest/environments_about.html")
]
raise(Puppet::Error, errmsg.join(' '))
end
new(node, :code_id => code_id).compile(&:to_resource)
rescue Puppet::ParseErrorWithIssue => detail
detail.node = node.name
Puppet.log_exception(detail)
raise
rescue => detail
message = _("%{message} on node %{node}") % { message: detail, node: node.name }
Puppet.log_exception(detail, message)
raise Puppet::Error, message, detail.backtrace
end
attr_reader :node, :facts, :collections, :catalog, :resources, :relationships, :topscope
attr_reader :qualified_variables
# Access to the configured loaders for 4x
# @return [Puppet::Pops::Loader::Loaders] the configured loaders
# @api private
attr_reader :loaders
# The id of code input to the compiler.
# @api private
attr_accessor :code_id
# Add a collection to the global list.
def_delegator :@collections, :<<, :add_collection
def_delegator :@relationships, :<<, :add_relationship
View on GitHub (pinned to e227c27540)
Solutions
- Find the original exception first - it was logged just above this error with its own class and backtrace
- Reproduce with --trace to get the Ruby backtrace of the underlying failure
- Fix the root cause in the function/module the backtrace points to
- If you need the node-stripped message, remove the trailing ' on node <name>'
Defensive patterns
Strategy: try-catch
Try / catch
begin Puppet::Parser::Compiler.compile(node) rescue Puppet::Error => e root = e.message.sub(/ on node .+\z/, '') report(node.name, root, e.backtrace) raise end
Prevention
- Always check the log lines above this error - the original exception with its own backtrace is logged before wrapping
- Compile catalogs with --trace and in CI (rspec-puppet) to catch Ruby-level failures early
- Pin module versions and test them against new Puppet/Ruby versions before upgrade
When it happens
Trigger: A custom Ruby function raising NoMethodError/TypeError during compile; broken external data lookups; Ruby incompatibilities in module code (e.g. Ruby 3 keyword-argument changes) surfacing during compilation.
Common situations: Puppet/Ruby major upgrades breaking third-party module functions; bugs in in-module Ruby code; corrupted facts causing deep code to fail.
Related errors
- Found %{num} dependency cycles:\n
- Unable to verify the SSL certificate at %{uri}
- No title provided and %{type} is not a valid resource refere
- Could not find resource '%{res}' in parameter '%{param}'
- Duplicate declaration: %{resource} is already declared; cann
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/c24b4aea4ec8a1d3.
Report an issue: GitHub.