{"record":{"id":"2d7f4ffe98c7d3e3","repo":"puppetlabs/puppet","slug":"resource-type-self-class-name-does-not-support","errorCode":null,"errorMessage":"Resource type #{self.class.name} does not support parameter #{name}","messagePattern":"Resource type #(.+?) does not support parameter #(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/type.rb","lineNumber":785,"sourceCode":"  # by this resource. Otherwise, an attribute instance is created\n  # and kept in this resource's parameters hash.\n  # @overload newattr(name)\n  #   @param name [Symbol] symbolic name of the attribute\n  # @overload newattr(klass)\n  #   @param klass [Class] a class supported as an attribute class, i.e. a subclass of\n  #     Parameter or Property\n  # @return [Object] An instance of the named Parameter or Property class associated\n  #   to this resource type instance, or nil if the attribute is not supported\n  #\n  def newattr(name)\n    if name.is_a?(Class)\n      klass = name\n      name = klass.name\n    end\n\n    klass = self.class.attrclass(name)\n    unless klass\n      raise Puppet::Error, \"Resource type #{self.class.name} does not support parameter #{name}\"\n    end\n\n    if provider and !provider.class.supports_parameter?(klass)\n      missing = klass.required_features.find_all { |f| !provider.class.feature?(f) }\n      debug \"Provider %s does not support features %s; not managing attribute %s\" % [provider.class.name, missing.join(\", \"), name]\n      return nil\n    end\n\n    return @parameters[name] if @parameters.include?(name)\n\n    @parameters[name] = klass.new(:resource => self)\n  end\n\n  # Returns a string representation of the resource's containment path in\n  # the catalog.\n  # @return [String]\n  def path\n    @path ||= '/' + pathbuilder.join('/')","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type.rb#L767-L803","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before (custom type: provider references undeclared param)\nPuppet::Type.newtype(:myapp) do\n  newparam(:name) { isnamevar }\nend\n# provider later calls resource.newattr(:config_path) => Puppet::Error\n\n# after\nPuppet::Type.newtype(:myapp) do\n  newparam(:name) { isnamevar }\n  newparam(:config_path) { desc 'Path to config file' }\nend","handlingStrategy":"validation","validationCode":"return nil unless self.class.attrclass(name) # guard before newattr\nraise \"type #{self.class.name} does not support parameter #{name}\" unless self.class.validattr?(name)","typeGuard":null,"tryCatchPattern":"begin\n  resource.newattr(name)\nrescue Puppet::Error => e\n  raise unless e.message =~ /does not support parameter/\n  Puppet.err \"skipping unsupported attribute #{name}\"\nend","preventionTips":["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"],"tags":["puppet","unknown-parameter","custom-type","typo"],"backgroundTag":"unknown-parameter","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}