{"record":{"id":"203f311de9b1ca4e","repo":"puppetlabs/puppet","slug":"could-not-find-resource-target-for-relationsh","errorCode":null,"errorMessage":"Could not find resource '%{target}' for relationship from '%{source}'","messagePattern":"Could not find resource '%(.+?)' for relationship from '%(.+?)'","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/parser/relationship.rb","lineNumber":48,"sourceCode":"    @target = target\n    @type = type\n  end\n\n  def param_name\n    PARAM_MAP[type] || raise(ArgumentError, _(\"Invalid relationship type %{relationship_type}\") % { relationship_type: type })\n  end\n\n  def mk_relationship(source, target, catalog)\n    source_ref = canonical_ref(source)\n    target_ref = canonical_ref(target)\n    rel_param = param_name\n\n    source_resource = catalog.resource(*source_ref)\n    unless source_resource\n      raise ArgumentError, _(\"Could not find resource '%{source}' for relationship on '%{target}'\") % { source: source.to_s, target: target.to_s }\n    end\n    unless catalog.resource(*target_ref)\n      raise ArgumentError, _(\"Could not find resource '%{target}' for relationship from '%{source}'\") % { target: target.to_s, source: source.to_s }\n    end\n\n    Puppet.debug { \"Adding relationship from #{source} to #{target} with '#{param_name}'\" }\n    if source_resource[rel_param].class != Array\n      source_resource[rel_param] = [source_resource[rel_param]].compact\n    end\n    source_resource[rel_param] << (target_ref[1].nil? ? target_ref[0] : \"#{target_ref[0]}[#{target_ref[1]}]\")\n  end\n\n  private\n\n  # Finds the leftmost alternative for a collector (if it is empty, try its empty alternative recursively until there is\n  # either nothing left, or a non empty set is found.\n  #\n  def leftmost_alternative(x)\n    if x.is_a?(Puppet::Pops::Evaluator::Collectors::AbstractCollector)\n      collected = x.collected\n      return collected.values unless collected.empty?","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/parser/relationship.rb#L30-L66","documentation":"Error \"Could not find resource '%{target}' for relationship from '%{source}'\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/parser/relationship.rb:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}