{"record":{"id":"52c27cd8d75f1d75","repo":"puppetlabs/puppet","slug":"failed-to-get-the-fmri-of-the-service-service","errorCode":null,"errorMessage":"Failed to get the FMRI of the %{service} service: The pattern '%{service}' matches multiple FMRIs! These are the FMRIs it matches: %{all_fmris}","messagePattern":"Failed to get the FMRI of the %(.+?) service: The pattern '%(.+?)' matches multiple FMRIs! These are the FMRIs it matches: %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/service/smf.rb","lineNumber":98,"sourceCode":"  end\n\n  # Returns the service's FMRI. We fail if multiple FMRIs correspond to\n  # @resource[:name].\n  #\n  # If the service does not exist or we fail to get any FMRIs from svcs,\n  # this method will raise a Puppet::Error\n  def service_fmri\n    return @fmri if @fmri\n\n    # `svcs -l` is better to use because we can detect service instances\n    # that have not yet been activated or enabled (i.e. it lets us detect\n    # services that svcadm has not yet touched). `svcs -H -o fmri` is a bit\n    # more limited.\n    lines = svcs(\"-l\", @resource[:name]).chomp.lines.to_a\n    lines.select! { |line| line =~ /^fmri/ }\n    fmris = lines.map! { |line| line.split(' ')[-1].chomp }\n    unless fmris.length == 1\n      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(', ') }\n    end\n\n    @fmri = fmris.first\n  end\n\n  # Returns true if the provider supports incomplete services.\n  def supports_incomplete_services?\n    Puppet::Util::Package.versioncmp(Puppet.runtime[:facter].value('os.release.full'), '11.1') >= 0\n  end\n\n  # Returns true if the service is complete. A complete service is a service that\n  # has the general/complete property defined.\n  def complete_service?\n    unless supports_incomplete_services?\n      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') }\n    end\n\n    return @complete_service if @complete_service","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/service/smf.rb#L80-L116","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the full unambiguous FMRI as the resource name: svc:/network/smtp:sendmail style","List the candidates exactly as the error does, or via svcs -l <name>, and pick the instance you meant","For multi-instance services, manage each instance as its own service resource keyed by FMRI"],"exampleFix":"# before\nservice { 'smtp':\n  ensure    => running,\n  provider  => 'smf',\n}\n\n# after\nservice { 'svc:/network/smtp:sendmail':\n  ensure    => running,\n  provider  => 'smf',\n}","handlingStrategy":"validation","validationCode":"# the name must resolve to exactly one FMRI\n[ \"$(svcs -H -o fmri \"${name}\" 2>/dev/null | wc -l)\" -eq 1 ] \\\n  || { echo \"ambiguous or unknown: use a full FMRI like svc:/network/smtp:sendmail\"; svcs -H -o fmri \"${name}\"; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store full FMRIs (svc:/...:instance) in your service data for Solaris; never abbreviated names","After installing multi-instance SMF services, enumerate instances with svcs -H -o fmri and manage each explicitly","Add a data-layer lint rule rejecting Solaris service names without the svc:/ scheme"],"tags":["puppet","solaris","smf","fmri","ambiguous-match"],"backgroundTag":"ambiguous-resource-identifier","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}