{"record":{"id":"d611eccccde3f44c","repo":"puppetlabs/puppet","slug":"could-not-find-resource-s-resources-for-overri","errorCode":null,"errorMessage":"Could not find resource(s) %{resources} for overriding","messagePattern":"Could not find resource\\(s\\) %(.+?) for overriding","errorType":"exception","errorClass":"Puppet::ParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/parser/compiler.rb","lineNumber":415,"sourceCode":"    add_resource(@topscope, @main_resource)\n\n    @main_resource.evaluate\n  end\n\n  # Make sure the entire catalog is evaluated.\n  def fail_on_unevaluated\n    fail_on_unevaluated_overrides\n    fail_on_unevaluated_resource_collections\n  end\n\n  # If there are any resource overrides remaining, then we could\n  # not find the resource they were supposed to override, so we\n  # want to throw an exception.\n  def fail_on_unevaluated_overrides\n    remaining = @resource_overrides.values.flatten.collect(&:ref)\n\n    unless remaining.empty?\n      raise Puppet::ParseError, _(\"Could not find resource(s) %{resources} for overriding\") % { resources: remaining.join(', ') }\n    end\n  end\n\n  # Make sure there are no remaining collections that are waiting for\n  # resources that have not yet been instantiated. If this occurs it\n  # is an error (missing resource - it could not be realized).\n  #\n  def fail_on_unevaluated_resource_collections\n    remaining = @collections.collect(&:unresolved_resources).flatten.compact\n    unless remaining.empty?\n      raise Puppet::ParseError, _(\"Failed to realize virtual resources %{resources}\") % { resources: remaining.join(', ') }\n    end\n  end\n\n  # Make sure all of our resources and such have done any last work\n  # necessary.\n  def finish\n    evaluate_relationships","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/parser/compiler.rb#L397-L433","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nservice { 'httpd': ... } never declared, but site.pp has:\nservice { 'httpd': subscribe => File['conf'] }\n\n// after\ninclude apache  # declares Service['httpd']\nservice { 'httpd': subscribe => File['conf'] }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  compiler.compile\nrescue Puppet::ParseError => e\n  if (m = e.message.match(/Could not find resource\\(s\\) (.+) for overriding/))\n    missing_overrides = m[1].split(', ')\n  end\n  raise\nend","preventionTips":["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"],"tags":["puppet","dsl","resource-override","catalog"],"backgroundTag":"override-target-missing","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}