puppetlabs/puppet · error · ArgumentError

Could not find resource '%{source}' for relationship on '%{t

Error message

Could not find resource '%{source}' for relationship on '%{target}'

What it means

Error "Could not find resource '%{source}' for relationship on '%{target}'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/parser/relationship.rb:45

  def initialize(source, target, type)
    @source = source
    @target = target
    @type = type
  end

  def param_name
    PARAM_MAP[type] || raise(ArgumentError, _("Invalid relationship type %{relationship_type}") % { relationship_type: type })
  end

  def mk_relationship(source, target, catalog)
    source_ref = canonical_ref(source)
    target_ref = canonical_ref(target)
    rel_param = param_name

    source_resource = catalog.resource(*source_ref)
    unless source_resource
      raise ArgumentError, _("Could not find resource '%{source}' for relationship on '%{target}'") % { source: source.to_s, target: target.to_s }
    end
    unless catalog.resource(*target_ref)
      raise ArgumentError, _("Could not find resource '%{target}' for relationship from '%{source}'") % { target: target.to_s, source: source.to_s }
    end

    Puppet.debug { "Adding relationship from #{source} to #{target} with '#{param_name}'" }
    if source_resource[rel_param].class != Array
      source_resource[rel_param] = [source_resource[rel_param]].compact
    end
    source_resource[rel_param] << (target_ref[1].nil? ? target_ref[0] : "#{target_ref[0]}[#{target_ref[1]}]")
  end

  private

  # Finds the leftmost alternative for a collector (if it is empty, try its empty alternative recursively until there is
  # either nothing left, or a non empty set is found.
  #
  def leftmost_alternative(x)

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/parser/relationship.rb:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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