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_relationships

View on GitHub (pinned to e227c27540)

Solutions

  1. Ensure the target resource's declaring class/resource is actually included/evaluated in this compile
  2. Fix the override's type/title to match the declaration exactly (including case and path form)
  3. If the target is virtual (@file), realize it (realize File['x'] or a collector) so the override can merge
  4. 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

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


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