puppetlabs/puppet · error · Puppet::Error

Failed to get the FMRI of the %{service} service: The patter

Error message

Failed to get the FMRI of the %{service} service: The pattern '%{service}' matches multiple FMRIs! These are the FMRIs it matches: %{all_fmris}

What it means

The SMF provider resolves a service's FMRI by running svcs -l <name>, filtering lines starting with 'fmri', and requires exactly one match; service_fmri raises when the count differs from 1. Multiple matches mean the name acts as an SMF pattern matching more than one service/instance (e.g. a plain name that both a service and its instances, or two services, answer to). The message conveniently lists every matching FMRI.

Source

Thrown at lib/puppet/provider/service/smf.rb:98

  end

  # Returns the service's FMRI. We fail if multiple FMRIs correspond to
  # @resource[:name].
  #
  # If the service does not exist or we fail to get any FMRIs from svcs,
  # this method will raise a Puppet::Error
  def service_fmri
    return @fmri if @fmri

    # `svcs -l` is better to use because we can detect service instances
    # that have not yet been activated or enabled (i.e. it lets us detect
    # services that svcadm has not yet touched). `svcs -H -o fmri` is a bit
    # more limited.
    lines = svcs("-l", @resource[:name]).chomp.lines.to_a
    lines.select! { |line| line =~ /^fmri/ }
    fmris = lines.map! { |line| line.split(' ')[-1].chomp }
    unless fmris.length == 1
      raise Puppet::Error, _("Failed to get the FMRI of the %{service} service: The pattern '%{service}' matches multiple FMRIs! These are the FMRIs it matches: %{all_fmris}") % { service: @resource[:name], all_fmris: fmris.join(', ') }
    end

    @fmri = fmris.first
  end

  # Returns true if the provider supports incomplete services.
  def supports_incomplete_services?
    Puppet::Util::Package.versioncmp(Puppet.runtime[:facter].value('os.release.full'), '11.1') >= 0
  end

  # Returns true if the service is complete. A complete service is a service that
  # has the general/complete property defined.
  def complete_service?
    unless supports_incomplete_services?
      raise Puppet::Error, _("Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.") % { service: @resource[:name], release: Puppet.runtime[:facter].value('os.release.full') }
    end

    return @complete_service if @complete_service

View on GitHub (pinned to e227c27540)

Solutions

  1. Use the full unambiguous FMRI as the resource name: svc:/network/smtp:sendmail style
  2. List the candidates exactly as the error does, or via svcs -l <name>, and pick the instance you meant
  3. For multi-instance services, manage each instance as its own service resource keyed by FMRI

Example fix

# before
service { 'smtp':
  ensure    => running,
  provider  => 'smf',
}

# after
service { 'svc:/network/smtp:sendmail':
  ensure    => running,
  provider  => 'smf',
}
Defensive patterns

Strategy: validation

Validate before calling

# the name must resolve to exactly one FMRI
[ "$(svcs -H -o fmri "${name}" 2>/dev/null | wc -l)" -eq 1 ] \
  || { echo "ambiguous or unknown: use a full FMRI like svc:/network/smtp:sendmail"; svcs -H -o fmri "${name}"; }

Prevention

When it happens

Trigger: Declaring service { 'network': ... } on Solaris where 'network' matches svc:/network/... plus legacy entries; using a short name when multiple instances exist (smtp vs svc:/network/smtp:sendmail and :postfix); any name where svcs -l emits more than one fmri line. Note the check is length != 1, so a filter yielding zero also trips this same 'multiple FMRIs' message.

Common situations: Writing manifests with abbreviated Solaris service names; multi-instance SMF services (application servers with named instances) where the instance qualifier was omitted; names colliding with pattern semantics of svcs.

Related errors


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