puppetlabs/puppet · error · Puppet::DevError
To support listing resources of this type the '%{provider}'
Error message
To support listing resources of this type the '%{provider}' provider needs to implement an 'instances' class method returning the current set of resources. We recommend porting your module to the simpler Resource API instead: https://puppet.com/search/docs?keys=resource+api What it means
Provider.instances is the abstract class method that enumerates existing system entities; it powers 'puppet resource <type>' listing, prefetching, and purge-style management via the resources metatype. The base implementation always raises Puppet::DevError, telling you to implement instances or port the provider to the Resource API. Seeing it means the selected provider for the type cannot list resources at all.
Source
Thrown at lib/puppet/provider.rb:383
# An implementation of this method should only cache the values of properties
# if they are discovered as part of the process for finding existing resources.
# Resource properties that require additional commands (than those used to determine existence/identity)
# should be implemented in their respective getter method. (This is important from a performance perspective;
# it may be expensive to compute, as well as wasteful as all discovered resources may perhaps not be managed).
#
# An implementation may return an empty list (naturally with the effect that it is not possible to query
# for manageable entities).
#
# By implementing this method, it is possible to use the `resources´ resource type to specify purging
# of all non managed entities.
#
# @note The returned instances are instance of some subclass of Provider, not resources.
# @return [Array<Puppet::Provider>] a list of providers referencing the system entities
# @abstract this method must be implemented by a subclass and this super method should never be called as it raises an exception.
# @raise [Puppet::DevError] Error indicating that the method should have been implemented by subclass.
# @see prefetch
def self.instances
raise Puppet::DevError, _("To support listing resources of this type the '%{provider}' provider needs to implement an 'instances' class method returning the current set of resources. We recommend porting your module to the simpler Resource API instead: https://puppet.com/search/docs?keys=resource+api") % { provider: name }
end
# Creates getter- and setter- methods for each property supported by the resource type.
# Call this method to generate simple accessors for all properties supported by the
# resource type. These simple accessors lookup and sets values in the property hash.
# The generated methods may be overridden by more advanced implementations if something
# else than a straight forward getter/setter pair of methods is required.
# (i.e. define such overriding methods after this method has been called)
#
# An implementor of a provider that makes use of `prefetch` and `flush` can use this method since it uses
# the internal `@property_hash` variable to store values. An implementation would then update the system
# state on a call to `flush` based on the current values in the `@property_hash`.
#
# @return [void]
#
def self.mk_resource_methods
[resource_type.validproperties, resource_type.parameters].flatten.each do |attr|
attr = attr.internView on GitHub (pinned to e227c27540)
Solutions
- Implement def self.instances in the provider: gather system state and return provider instances via new(name: n, ensure: :present, ...).
- Or port the provider to the Puppet Resource API (pdk new provider), where instances is generated from the schema.
- Do not use puppet resource or purging with types whose providers cannot enumerate.
Example fix
# before (provider)
Puppet::Type.type(:mything).provide(:ruby) do
# no self.instances -> puppet resource mything raises Puppet::DevError
end
# after
Puppet::Type.type(:mything).provide(:ruby) do
def self.instances
Dir['/etc/mything/*'].map do |path|
new(name: File.basename(path), ensure: :present)
end
end
end Defensive patterns
Strategy: validation
Validate before calling
def implements_instances?(provider_class) provider_class.method(:instances).owner != Puppet::Provider end # skip listing when false exit 0 unless implements_instances?(Puppet::Type.type(:mything).provider(:ruby))
Try / catch
begin
Puppet::Type.type(:mything).provider(:ruby).instances
rescue Puppet::DevError => e
Puppet.err("mything provider cannot list resources: #{e.message}")
[]
end Prevention
- Implement self.instances in every provider meant to support puppet resource or prefetching.
- Gate inventory scripts on the provider actually overriding instances.
- Consider the Puppet Resource API for new types - listing support comes for free.
When it happens
Trigger: Running puppet resource mytype on a custom type whose provider only implements instance methods; using resources { myresources: purge => true } for a type whose provider lacks instances; calling Provider.instances directly from Ruby tooling.
Common situations: Custom types written only for declared resources; third-party modules that never supported puppet resource; inventory tooling that enumerates types via puppet resource.
Related errors
- No ability to determine if %{name} exists
- No command %{command} defined for provider %{provider}
- Unable to verify the SSL certificate at %{uri}
- Provider %{provider} must have features '%{needed_feature}'
- Could not set %{property} on %{resource}[%{name}]: %{detail}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/c9cd23edd657d4dc.
Report an issue: GitHub.