puppetlabs/puppet · error · Puppet::DevError
No ability to determine if %{name} exists
Error message
No ability to determine if %{name} exists What it means
For the ensure property, retrieve decides :present vs :absent by asking resource.provider for exists?, falling back to the resource type itself. When neither side responds to exists?, Puppet::DevError 'No ability to determine if <type> exists' is raised the moment the resource is evaluated. It always indicates a custom type/provider gap: core types implement exists? somewhere in their provider stack.
Source
Thrown at lib/puppet/property/ensure.rb:88
# `:exists`), and secondly the resource. A a value of `:present` or `:absent` is returned
# depending on if the managed entity exists or not.
#
# @return [Symbol] a value of `:present` or `:absent` depending on if it exists or not
# @raise [Puppet::DevError] if neither the provider nor the resource responds to `:exists`
#
def retrieve
# XXX This is a problem -- whether the object exists or not often
# depends on the results of other properties, yet we're the first property
# to get checked, which means that those other properties do not have
# @is values set. This seems to be the source of quite a few bugs,
# although they're mostly logging bugs, not functional ones.
prov = @resource.provider
if prov && prov.respond_to?(:exists?)
result = prov.exists?
elsif @resource.respond_to?(:exists?)
result = @resource.exists?
else
raise Puppet::DevError, _("No ability to determine if %{name} exists") % { name: @resource.class.name }
end
if result
:present
else
:absent
end
end
# If they're talking about the thing at all, they generally want to
# say it should exist.
# defaultto :present
defaultto do
if @resource.managed?
:present
else
nil
end
endView on GitHub (pinned to e227c27540)
Solutions
- Implement def exists? as an instance method in the provider class.
- Verify a provider is actually suitable (confine, commands, defaultfor) so the resource gets one.
- If the type can decide existence without a provider, define exists? on the resource type itself.
Example fix
# before (provider)
Puppet::Type.type(:mything).provide(:ruby) do
# no exists? -> ensure raises Puppet::DevError on retrieve
end
# after
Puppet::Type.type(:mything).provide(:ruby) do
def exists?
File.exist?("/etc/mything/#{resource[:name]}")
end
end Defensive patterns
Strategy: validation
Validate before calling
prov = resource.provider
unless prov.nil? || prov.respond_to?(:exists?) || resource.respond_to?(:exists?)
raise Puppet::Error, "#{resource.class.name} has no provider that implements exists?"
end Type guard
def can_determine_existence?(resource) (resource.provider && resource.provider.respond_to?(:exists?)) || resource.respond_to?(:exists?) end
Try / catch
begin
resource.property(:ensure).retrieve
rescue Puppet::DevError => e
raise unless e.message =~ /No ability to determine/
Puppet.err("#{resource}: no provider exists?; skipping")
end Prevention
- Every provider for a type with ensure must implement instance-level exists?.
- Smoke-test custom types with puppet resource <type> --debug before shipping.
- Check provider suitability (confine/defaultfor) on the target platform so a provider is actually selected.
When it happens
Trigger: A custom type with no suitable provider on the platform; a provider that implements exists? as a class method (def self.exists?) instead of an instance method; a provider whose exists? was lost in a refactor.
Common situations: Custom types under development; providers whose confine rules exclude the current platform so no provider is selected; types intended for prefetch-only flows that never define existence.
Related errors
- Provider %{provider} must have features '%{needed_feature}'
- Could not convert change %{name} to string: %{detail}
- To support listing resources of this type the '%{provider}'
- Unable to verify the SSL certificate at %{uri}
- Unable to connect to the server at %{uri}. Detail: %{detail}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/8d049e6823153ad8.
Report an issue: GitHub.