puppetlabs/puppet · error · ArgumentError

Could not find %{name} provider of %{provider}

Error message

Could not find %{name} provider of %{provider}

What it means

Puppet::Type#provider= is the setter behind the provider parameter and provider retrieval. Given a name (not a Puppet::Provider instance), it looks up self.class.provider(name); when the type has no such suitable provider registered, ArgumentError 'Could not find <name> provider of <type>' is raised. This is the same root cause as the provider-parameter validation error, but raised from the setter path used by Ruby code and by the munge that assigns @resource.provider.

Source

Thrown at lib/puppet/type.rb:1960

  # @overload provider=(name)
  #   Sets the provider to the result of resolving the name to an instance of Provider.
  #   @param name [String] the name of the provider
  # @overload provider=(provider)
  #   Sets the provider to the given instances of Provider.
  #   @param provider [Puppet::Provider] the provider to set
  # @return [Puppet::Provider] the provider set
  # @raise [ArgumentError] if the provider could not be found/resolved.
  #
  def provider=(name)
    if name.is_a?(Puppet::Provider)
      @provider = name
      @provider.resource = self
    else
      klass = self.class.provider(name)
      if klass
        @provider = klass.new(self)
      else
        raise ArgumentError, _("Could not find %{name} provider of %{provider}") % { name: name, provider: self.class.name }
      end
    end
  end

  ###############################
  # All of the relationship code.

  # Adds a block producing a single name (or list of names) of the given
  # resource type name to autorelate.
  #
  # The four relationship types require, before, notify, and subscribe are all
  # supported.
  #
  # Be *careful* with notify and subscribe as they may have unintended
  # consequences.
  #
  # Resources in the catalog that have the named type and a title that is
  # included in the result will be linked to the calling resource as a

View on GitHub (pinned to e227c27540)

Solutions

  1. Check suitability before assigning: return unless self.class.provider(name) (Ruby) — the same guard the setter lacks
  2. Prefer omitting provider and letting the type choose its defaultprovider
  3. On the affected node, verify why the provider is filtered out: missing binary/gem/fact confine, then install or fix facts
  4. Update the name to the provider's current spelling in the installed module version

Example fix

# before
resource.provider = provider_name # raises ArgumentError when unsuitable

# after
if klass = resource.class.provider(provider_name)
  resource.provider = klass
else
  Puppet.warning "provider #{provider_name} unavailable; using default"
  resource.provider = resource.class.defaultprovider
end
Defensive patterns

Strategy: validation

Validate before calling

if klass = self.class.provider(name)
  self.provider = klass
else
  self.provider = self.class.defaultprovider
end

Try / catch

begin
  resource.provider = name
rescue ArgumentError => e
  raise unless e.message =~ /Could not find .* provider/
  resource.provider = resource.class.defaultprovider
end

Prevention

When it happens

Trigger: Ruby-side resource.provider = :missing; type/provider code resolving a provider name from data (e.g., a fact-driven provider choice) where the name has no suitable match on this node; custom types calling provider= during prefetch with a stale name; string names work since provider(name) handles strings, but the provider must exist and be suitable.

Common situations: Programmatic resource assembly (Bolt tasks, orchestrators) that sets provider from an inventory variable; provider suites where one provider's gem dependency is missing on a subset of nodes; renamed providers between module versions (e.g., pip3 vs pip).

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/76822bfdee74ed81. Report an issue: GitHub.