{"record":{"id":"7f1b6c8082990842","repo":"puppetlabs/puppet","slug":"unknown-format-resource-name-state","errorCode":null,"errorMessage":"Unknown format %{resource_name}: %{state}","messagePattern":"Unknown format %(.+?): %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/pkg.rb","lineNumber":96,"sourceCode":"  # Frozen was never implemented in UFOXI so skipping frozen here.\n  def self.ufoxi_flag(flags)\n    {}\n  end\n\n  # pkg state was present in the older version of pkg (with UFOXI) but is\n  # no longer available with the IFO field version. When it was present,\n  # it was used to indicate that a particular version was present (installed)\n  # and later versions were known. Note that according to the pkg man page,\n  # known never lists older versions of the package. So we can rely on this\n  # field to make sure that if a known is present, then the pkg is upgradable.\n  def self.pkg_state(state)\n    case state\n    when /installed/\n      { :status => 'installed' }\n    when /known/\n      { :status => 'known' }\n    else\n      raise ArgumentError, _('Unknown format %{resource_name}: %{state}') % { resource_name: name, state: state }\n    end\n  end\n\n  # Here is (hopefully) the only place we will have to deal with multiple\n  # formats of output for different pkg versions.\n  def self.parse_line(line)\n    (case line.chomp\n     # FMRI                                                                         IFO\n     # pkg://omnios/SUNWcs@0.5.11,5.11-0.151008:20131204T022241Z                    ---\n     when %r{^pkg://([^/]+)/([^@]+)@(\\S+) +(...)$}\n       { :publisher => Regexp.last_match(1), :name => Regexp.last_match(2), :ensure => Regexp.last_match(3) }.merge ifo_flag(Regexp.last_match(4))\n\n     # FMRI                                                             STATE      UFOXI\n     # pkg://solaris/SUNWcs@0.5.11,5.11-0.151.0.1:20101105T001108Z      installed  u----\n     when %r{^pkg://([^/]+)/([^@]+)@(\\S+) +(\\S+) +(.....)$}\n       { :publisher => Regexp.last_match(1), :name => Regexp.last_match(2), :ensure => Regexp.last_match(3) }.merge pkg_state(Regexp.last_match(4)).merge(ufoxi_flag(Regexp.last_match(5)))\n\n     else","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/pkg.rb#L78-L114","documentation":"Raised by `pkg_state` (lib/puppet/provider/package/pkg.rb:96) in the Solaris `pkg` provider. For the legacy UFOXI output format (pre-2010 snv / Solaris 11 Express era), the STATE column of `pkg list` is mapped by regex to `installed` or `known`; a state that matches neither /installed/ nor /known/ cannot be classified, so an ArgumentError carrying the raw state string is raised.","triggerScenarios":"`parse_line` matched the legacy `pkg://publisher/name@version STATE UFOXI` regex and handed `pkg_state` a state token such as `excluded`, `uninstalled`, `incompatible`, or localized text instead of installed/known.","commonSituations":"Old Solaris 11 Express / snv_151a-era images; hosts where a non-C locale changes `pkg` message text; mixed-generation boot environments after a partial upgrade.","solutions":["Run `pkg list -Hv <package>` to see the exact STATE column value the provider choked on.","Force a C locale for the agent's commands (e.g. set LANG/LC_ALL=C in the agent environment) so pkg output is not localized.","Upgrade puppet-agent; newer releases track additional pkg formats.","Update the boot environment (`pkg update`) so the host emits the modern IFO format the provider handles best."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Force C locale for pkg and precheck the STATE column on legacy-format hosts\nexport LANG=C LC_ALL=C\npkg list -Hv <name> | awk '{ print $(NF-1) }' | grep -Eq 'installed|known' || echo \"unparseable state - do not run puppet yet\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set LANG/LC_ALL=C in the agent environment on Solaris hosts.","Upgrade old snv/Solaris 11 Express images so they emit the modern IFO format.","Test `pkg list -Hv` output shape after every OS upgrade."],"tags":["solaris","pkg","state","parse-error","locale","argument-error"],"backgroundTag":"command-output-parse-failure","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}