puppetlabs/puppet · error · Puppet::Error
Resource type #{self.class.name} does not support parameter
Error message
Resource type #{self.class.name} does not support parameter #{name} What it means
Puppet::Type#newattr resolves an attribute name to its Parameter/Property class via self.class.attrclass(name). When the type never declared that attribute, klass is nil and Puppet::Error 'Resource type X does not support parameter Y' is raised. Note the sibling guard in []= ('no parameter named...') catches most manifest-level typos earlier; this specific raise surfaces from internal property-creation paths and direct newattr calls, e.g. providers or custom types referencing an attribute that was never declared with newparam/newproperty.
Source
Thrown at lib/puppet/type.rb:785
# by this resource. Otherwise, an attribute instance is created
# and kept in this resource's parameters hash.
# @overload newattr(name)
# @param name [Symbol] symbolic name of the attribute
# @overload newattr(klass)
# @param klass [Class] a class supported as an attribute class, i.e. a subclass of
# Parameter or Property
# @return [Object] An instance of the named Parameter or Property class associated
# to this resource type instance, or nil if the attribute is not supported
#
def newattr(name)
if name.is_a?(Class)
klass = name
name = klass.name
end
klass = self.class.attrclass(name)
unless klass
raise Puppet::Error, "Resource type #{self.class.name} does not support parameter #{name}"
end
if provider and !provider.class.supports_parameter?(klass)
missing = klass.required_features.find_all { |f| !provider.class.feature?(f) }
debug "Provider %s does not support features %s; not managing attribute %s" % [provider.class.name, missing.join(", "), name]
return nil
end
return @parameters[name] if @parameters.include?(name)
@parameters[name] = klass.new(:resource => self)
end
# Returns a string representation of the resource's containment path in
# the catalog.
# @return [String]
def path
@path ||= '/' + pathbuilder.join('/')View on GitHub (pinned to e227c27540)
Solutions
- Verify what the type supports: puppet describe -s <type> (or check its newparam/newproperty declarations in the source)
- For custom types, declare the attribute: newparam(:foo) { ... } or newproperty(:foo) in the type definition
- Guard in Ruby: return unless self.class.attrclass(name) before calling newattr
- If a module update removed the parameter, pin or update the module to a matching version
Example fix
# before (custom type: provider references undeclared param)
Puppet::Type.newtype(:myapp) do
newparam(:name) { isnamevar }
end
# provider later calls resource.newattr(:config_path) => Puppet::Error
# after
Puppet::Type.newtype(:myapp) do
newparam(:name) { isnamevar }
newparam(:config_path) { desc 'Path to config file' }
end Defensive patterns
Strategy: validation
Validate before calling
return nil unless self.class.attrclass(name) # guard before newattr
raise "type #{self.class.name} does not support parameter #{name}" unless self.class.validattr?(name) Try / catch
begin
resource.newattr(name)
rescue Puppet::Error => e
raise unless e.message =~ /does not support parameter/
Puppet.err "skipping unsupported attribute #{name}"
end Prevention
- For custom types, declare every attribute the provider touches with newparam/newproperty
- Run puppet describe -s <type> after type changes
- Keep provider/type pairs version-locked in the same module
When it happens
Trigger: Calling resource.newattr(:misspelled) or newattr(:undeclared) from Ruby; custom provider code doing resource.newattr(:ensure) on a type where ensure is a param not a property; setting attributes on a type whose defining module failed to load its newparam declarations; misspelled parameters in manifests usually hit the earlier validattr? guard instead.
Common situations: Writing a custom type where the provider references a parameter you forgot to declare; version mismatches where a module expects a parameter that the installed type version removed; copy-pasted provider code from a different type.
Related errors
- Unable to connect to the server at %{uri}. Detail: %{detail}
- Supported values for Property#array_matching are 'first' and
- Attempt to redefine method %{method} with block
- Could not convert change '%{name}' to string: %{detail}
- Provider %{provider} must have features '%{needed_feature}'
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/2d7f4ffe98c7d3e3.
Report an issue: GitHub.