{"record":{"id":"8d049e6823153ad8","repo":"puppetlabs/puppet","slug":"no-ability-to-determine-if-name-exists","errorCode":null,"errorMessage":"No ability to determine if %{name} exists","messagePattern":"No ability to determine if %(.+?) exists","errorType":"exception","errorClass":"Puppet::DevError","httpStatus":null,"severity":"error","filePath":"lib/puppet/property/ensure.rb","lineNumber":88,"sourceCode":"  # `:exists`), and secondly the resource. A a value of `:present` or `:absent` is returned\n  # depending on if the managed entity exists or not.\n  #\n  # @return [Symbol] a value of `:present` or `:absent` depending on if it exists or not\n  # @raise [Puppet::DevError] if neither the provider nor the resource responds to `:exists`\n  #\n  def retrieve\n    # XXX This is a problem -- whether the object exists or not often\n    # depends on the results of other properties, yet we're the first property\n    # to get checked, which means that those other properties do not have\n    # @is values set.  This seems to be the source of quite a few bugs,\n    # although they're mostly logging bugs, not functional ones.\n    prov = @resource.provider\n    if prov && prov.respond_to?(:exists?)\n      result = prov.exists?\n    elsif @resource.respond_to?(:exists?)\n      result = @resource.exists?\n    else\n      raise Puppet::DevError, _(\"No ability to determine if %{name} exists\") % { name: @resource.class.name }\n    end\n    if result\n      :present\n    else\n      :absent\n    end\n  end\n\n  # If they're talking about the thing at all, they generally want to\n  # say it should exist.\n  # defaultto :present\n  defaultto do\n    if @resource.managed?\n      :present\n    else\n      nil\n    end\n  end","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/property/ensure.rb#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (provider)\nPuppet::Type.type(:mything).provide(:ruby) do\n  # no exists? -> ensure raises Puppet::DevError on retrieve\nend\n\n# after\nPuppet::Type.type(:mything).provide(:ruby) do\n  def exists?\n    File.exist?(\"/etc/mything/#{resource[:name]}\")\n  end\nend","handlingStrategy":"validation","validationCode":"prov = resource.provider\nunless prov.nil? || prov.respond_to?(:exists?) || resource.respond_to?(:exists?)\n  raise Puppet::Error, \"#{resource.class.name} has no provider that implements exists?\"\nend","typeGuard":"def can_determine_existence?(resource)\n  (resource.provider && resource.provider.respond_to?(:exists?)) || resource.respond_to?(:exists?)\nend","tryCatchPattern":"begin\n  resource.property(:ensure).retrieve\nrescue Puppet::DevError => e\n  raise unless e.message =~ /No ability to determine/\n  Puppet.err(\"#{resource}: no provider exists?; skipping\")\nend","preventionTips":["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."],"tags":["puppet","provider","ensure","custom-type","abstract-method"],"backgroundTag":"provider-exists-not-implemented","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}