puppetlabs/puppet · error · ArgumentError
No name provided in serialized data
Error message
No name provided in serialized data
What it means
Puppet::Node#initialize_from_hash restores a node from its serialized form (e.g. a node.yaml produced by a terminus). 'name' is the only mandatory key: classes and parameters default to empty collections, but a missing 'name' raises ArgumentError 'No name provided in serialized data' during deserialization.
Source
Thrown at lib/puppet/node.rb:29
# the node sources.
extend Puppet::Indirector
# Asymmetric serialization/deserialization required in this class via to/from datahash
include Puppet::Util::PsychSupport
# Use the node source as the indirection terminus.
indirects :node, :terminus_setting => :node_terminus, :doc => "Where to find node information.
A node is composed of its name, its facts, and its environment."
attr_accessor :name, :classes, :source, :ipaddress, :parameters, :environment_name
attr_reader :time, :facts, :trusted_data
attr_reader :server_facts
ENVIRONMENT = 'environment'
def initialize_from_hash(data)
@name = data['name'] || (raise ArgumentError, _("No name provided in serialized data"))
@classes = data['classes'] || []
@parameters = data['parameters'] || {}
env_name = data['environment'] || @parameters[ENVIRONMENT]
unless env_name.nil?
@parameters[ENVIRONMENT] = env_name
@environment_name = env_name.intern
end
end
def self.from_data_hash(data)
node = new(name)
node.initialize_from_hash(data)
node
end
def to_data_hash
result = {
'name' => name,View on GitHub (pinned to e227c27540)
Solutions
- Fix the producer so it writes the node name (the certname) into the serialized hash
- If the hash comes from a cache file, delete and regenerate it rather than patching
- As recovery, default the name before loading: data['name'] ||= Puppet[:certname]
- Validate the YAML structure (Hash with a String 'name') before handing it to initialize_from_hash
Example fix
# before
data = YAML.load_file('node.yaml') # { 'classes' => [...] }
node = Puppet::Node.new('placeholder').tap { |n| n.initialize_from_hash(data) }
# after
data = YAML.load_file('node.yaml')
data['name'] ||= Puppet[:certname]
node = Puppet::Node.new(data['name']).tap { |n| n.initialize_from_hash(data) } Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, "serialized node lacks required 'name'" unless data.is_a?(Hash) && data['name'].is_a?(String) && !data['name'].empty?
node = Puppet::Node.new(data['name']).tap { |n| n.initialize_from_hash(data) } Prevention
- Validate required keys before deserializing persisted objects
- Treat cache files as disposable: regenerate rather than patch corrupted YAML
When it happens
Trigger: Loading a node hash that contains classes/parameters but no 'name' entry: a truncated node.yaml cache, an ENC or external tool emitting the hash without name, or hand-edited YAML where the key was removed.
Common situations: Corrupted node caches after crashes; tooling that round-trips nodes through YAML; schema drift where the producer stopped writing the name field.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- #{path}: #{detail.message}
- Could not intern from %{format}: %{err}
- Could not intern_multiple from %{format}: %{err}
- Serialized YAML did not contain a valid instance of %{klass}
- Serialized YAML did not contain a collection of instances wh
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/a559acbc1ea7541d.
Report an issue: GitHub.