puppetlabs/puppet · error · Puppet::ParseError
Could not find resource(s) %{resources} for overriding
Error message
Could not find resource(s) %{resources} for overriding What it means
Resource overrides (e.g. Service['x'] { subscribe => File['y'] }) are merged into their target when possible, otherwise stored (add_override) and retried later. At the end of compilation fail_on_unevaluated_overrides raises Puppet::ParseError listing every override whose target resource never made it into the catalog.
Source
Thrown at lib/puppet/parser/compiler.rb:415
add_resource(@topscope, @main_resource)
@main_resource.evaluate
end
# Make sure the entire catalog is evaluated.
def fail_on_unevaluated
fail_on_unevaluated_overrides
fail_on_unevaluated_resource_collections
end
# If there are any resource overrides remaining, then we could
# not find the resource they were supposed to override, so we
# want to throw an exception.
def fail_on_unevaluated_overrides
remaining = @resource_overrides.values.flatten.collect(&:ref)
unless remaining.empty?
raise Puppet::ParseError, _("Could not find resource(s) %{resources} for overriding") % { resources: remaining.join(', ') }
end
end
# Make sure there are no remaining collections that are waiting for
# resources that have not yet been instantiated. If this occurs it
# is an error (missing resource - it could not be realized).
#
def fail_on_unevaluated_resource_collections
remaining = @collections.collect(&:unresolved_resources).flatten.compact
unless remaining.empty?
raise Puppet::ParseError, _("Failed to realize virtual resources %{resources}") % { resources: remaining.join(', ') }
end
end
# Make sure all of our resources and such have done any last work
# necessary.
def finish
evaluate_relationshipsView on GitHub (pinned to e227c27540)
Solutions
- Ensure the target resource's declaring class/resource is actually included/evaluated in this compile
- Fix the override's type/title to match the declaration exactly (including case and path form)
- If the target is virtual (@file), realize it (realize File['x'] or a collector) so the override can merge
- Remove overrides for conditionally-declared resources or make them conditional too
Example fix
// before
service { 'httpd': ... } never declared, but site.pp has:
service { 'httpd': subscribe => File['conf'] }
// after
include apache # declares Service['httpd']
service { 'httpd': subscribe => File['conf'] } Defensive patterns
Strategy: try-catch
Try / catch
begin
compiler.compile
rescue Puppet::ParseError => e
if (m = e.message.match(/Could not find resource\(s\) (.+) for overriding/))
missing_overrides = m[1].split(', ')
end
raise
end Prevention
- Keep overrides in the same class/file as (or conditional on) the declarations they target
- Match override refs exactly: same type casing and title as the declaration
- Compile every node role in CI (rspec-puppet) so orphan overrides fail before deploy
When it happens
Trigger: An override for a resource declared in a class that is never included; overriding File['/tmp/x'] when the title/type casing differs from the declaration; overriding a virtual resource that is never realized.
Common situations: Stale overrides in site.pp left after a role stopped including the declaring class; title casing or path normalization mismatches; overrides against resources that only exist on some nodes.
Related errors
- Failed to realize virtual resources %{resources}
- 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/d611eccccde3f44c.
Report an issue: GitHub.