puppetlabs/puppet · error · ArgumentError
Could not intern from data: Could not find relationship sour
Error message
Could not intern from data: Could not find relationship source %{source} for %{target} What it means
While deserializing a catalog with Puppet::Resource::Catalog.from_data_hash (intern), each entry of data['edges'] is turned into a Puppet::Relationship and its source is resolved against the resources rebuilt from data['resources']. If no resource matches edge.source, ArgumentError is raised: the payload contains a relationship whose source resource was never included.
Source
Thrown at lib/puppet/resource/catalog.rb:437
environment = data['environment']
if environment
result.environment = environment
result.environment_instance = Puppet::Node::Environment.remote(environment.to_sym)
end
result.add_resource(
*data['resources'].collect do |res|
Puppet::Resource.from_data_hash(res)
end
) if data['resources']
if data['edges']
data['edges'].each do |edge_hash|
edge = Puppet::Relationship.from_data_hash(edge_hash)
source = result.resource(edge.source)
unless source
raise ArgumentError, _("Could not intern from data: Could not find relationship source %{source} for %{target}") %
{ source: edge.source.inspect, target: edge.target.to_s }
end
edge.source = source
target = result.resource(edge.target)
unless target
raise ArgumentError, _("Could not intern from data: Could not find relationship target %{target} for %{source}") %
{ target: edge.target.inspect, source: edge.source.to_s }
end
edge.target = target
result.add_edge(edge)
end
end
result.add_class(*data['classes']) if data['classes']
result.metadata = data['metadata'].transform_values { |v| Puppet::FileServing::Metadata.from_data_hash(v); } if data['metadata']View on GitHub (pinned to e227c27540)
Solutions
- Inspect the payload: collect all "Type[Title]" strings from data['resources'] and verify every data['edges'][i]['source'] is present.
- Regenerate the serialized catalog from a live compile instead of patching it by hand.
- Align the Puppet version of the producer and consumer so resource hashes serialize identically.
- If edges are optional metadata, strip dangling edges from the hash before calling from_data_hash.
Example fix
# before
catalog = Puppet::Resource::Catalog.from_data_hash(data)
# after — validate edge endpoints first
refs = data['resources'].to_a.map { |r| "#{r['type']}[#{r['title']}]" }
data['edges'].to_a.each do |e|
raise ArgumentError, "payload edge source #{e['source']} has no matching resource" unless refs.include?(e['source'])
end
catalog = Puppet::Resource::Catalog.from_data_hash(data) Defensive patterns
Strategy: validation
Validate before calling
refs = data['resources'].to_a.map { |r| "#{r['type']}[#{r['title']}]" }.to_set
data['edges'].to_a.each do |e|
raise ArgumentError, "edge source #{e['source']} missing from resources" unless refs.include?(e['source'])
end
catalog = Puppet::Resource::Catalog.from_data_hash(data) Try / catch
begin
catalog = Puppet::Resource::Catalog.from_data_hash(data)
rescue ArgumentError => e
raise unless e.message.start_with?('Could not intern from data')
raise ArgumentError, "serialized catalog is inconsistent: #{e.message}"
end Prevention
- Never hand-edit serialized catalogs; regenerate from a real compile
- Round-trip test (to_data_hash -> from_data_hash) any payload you generate
- Keep producer and consumer on the same Puppet version when exchanging catalog data
When it happens
Trigger: A serialized catalog hash whose 'resources' list was filtered or hand-edited (a resource removed) while its 'edges' still reference it; producer/consumer Puppet version mismatch changing resource serialization; orchestration or export tooling that builds catalog data hashes itself and forgets edge endpoints.
Common situations: Post-processing catalog dumps from PuppetDB or puppet catalog compile; partial payloads after a failed transfer; tests feeding hand-written fixture catalogs with edges pointing at resources never declared.
Related errors
- Could not intern from data: Could not find relationship targ
- 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/75d9cc0fed3e155e.
Report an issue: GitHub.