puppetlabs/puppet · error · MissingMetadata
No #{attr} module metadata provided for #{name}
Error message
No #{attr} module metadata provided for #{name} What it means
Puppet::Module#load_metadata walks the five required keys — source, author, version, license, dependencies — and raises Puppet::Module::MissingMetadata when any value is nil (lib/puppet/module.rb:253). Unlike the malformed-JSON case, this always raises regardless of the `strict` setting. Empty strings pass (only nil fails), but a missing, null, or misnamed key aborts module loading.
Source
Thrown at lib/puppet/module.rb:253
when :warning
Puppet.warning(msg)
when :error
raise FaultyMetadata, msg
end
{}
end
def load_metadata
return if instance_variable_defined?(:@metadata)
@metadata = data = read_metadata
return if data.empty?
@forge_name = data['name'].tr('-', '/') if data['name']
[:source, :author, :version, :license, :dependencies].each do |attr|
value = data[attr.to_s]
raise MissingMetadata, "No #{attr} module metadata provided for #{name}" if value.nil?
if attr == :dependencies
unless value.is_a?(Array)
raise MissingMetadata, "The value for the key dependencies in the file metadata.json of the module #{name} must be an array, not: '#{value}'"
end
value.each do |dep|
name = dep['name']
dep['name'] = name.tr('-', '/') unless name.nil?
dep['version_requirement'] ||= '>= 0.0.0'
end
end
send(attr.to_s + "=", value)
end
end
# Return the list of manifests matching the given glob pattern,View on GitHub (pinned to e227c27540)
Solutions
- Add all five keys with real values: source, author, version, license, dependencies (dependencies may be an empty array)
- Use exact spellings: `license` (US spelling), `author` (singular)
- Generate the file with pdk or `puppet module generate` and fill in the template
Example fix
// before (metadata.json)
{
"name": "acme-web",
"version": "1.0.0"
}
// after
{
"name": "acme-web",
"version": "1.0.0",
"author": "acme",
"license": "Apache-2.0",
"source": "https://github.com/acme/puppet-web",
"dependencies": []
} Defensive patterns
Strategy: try-catch
Validate before calling
required = %w[source author version license dependencies]
data = Puppet::Util::Json.load(File.read('metadata.json'))
missing = required.select { |k| data[k].nil? }
raise ArgumentError, "metadata.json missing: #{missing.join(', ')}" unless missing.empty? Try / catch
begin
mod = Puppet::Module.find(name, environment)
mod.load_metadata if mod
rescue Puppet::Module::MissingMetadata => e
Puppet.warning("module #{name}: #{e.message}")
next
end Prevention
- Emit all five required keys (source, author, version, license, dependencies) in every metadata.json
- Spell keys exactly: `license` (US spelling), `author` (singular)
- Validate metadata completeness with pdk or metadata-json-lint before publishing
When it happens
Trigger: metadata.json containing only name/version; a key explicitly set to JSON null; misspellings like 'licence' or 'authors' that leave the expected key nil.
Common situations: Hand-written minimal metadata for internal modules; metadata written by tooling unfamiliar with Forge conventions; refactoring that drops a key.
Related errors
- %{name} has an invalid and unparsable metadata.json file. Th
- The value for the key dependencies in the file metadata.json
- Dependency conflict for %{module_name}: Dependency %{name} w
- Invalid 'name' field in metadata.json: %{err}
- Invalid 'version' field in metadata.json: %{err}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/3317f19f5496cab8.
Report an issue: GitHub.