{"record":{"id":"fedadc2559728a2b","repo":"puppetlabs/puppet","slug":"unknown-line-format-resource-name-parse-line","errorCode":null,"errorMessage":"Unknown line format %{resource_name}: %{parse_line}","messagePattern":"Unknown line format %(.+?): %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/pkg.rb","lineNumber":115,"sourceCode":"    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\n       raise ArgumentError, _('Unknown line format %{resource_name}: %{parse_line}') % { resource_name: name, parse_line: line }\n     end).merge({ :provider => name })\n  end\n\n  def hold\n    pkg(:freeze, @resource[:name])\n  end\n\n  def unhold\n    r = exec_cmd(command(:pkg), 'unfreeze', @resource[:name])\n    raise Puppet::Error, _(\"Unable to unfreeze %{package}\") % { package: r[:out] } unless [0, 4].include? r[:exit]\n  end\n\n  def insync?(is)\n    # this is called after the generic version matching logic (insync? for the\n    # type), so we only get here if should != is, and 'should' is a version\n    # number. 'is' might not be, though.\n    should = @resource[:ensure]\n    # NB: it is apparently possible for repository administrators to publish","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/pkg.rb#L97-L133","documentation":"Raised by `parse_line` (lib/puppet/provider/package/pkg.rb:115) when a line of `pkg list -Hv` output matches neither of the two accepted shapes: the modern `pkg://publisher/name@version` + 3-char IFO flags, nor the legacy `pkg://publisher/name@version STATE` + 5-char UFOXI flags. The provider refuses to guess and raises ArgumentError echoing the unparsable line.","triggerScenarios":"Any package query/prefetch on a host whose `pkg` prints a reformatted list line: extra columns (e.g. Solaris 11.4 SRUs), a package name breaking the `\\S+`/`([^@]+)` expectations, wrapped or truncated output, or pre-line noise from wrappers.","commonSituations":"Newer Solaris 11.4 / OmniOS releases changing `pkg list -v` column layout; pkg output run through a shell wrapper or locale that alters spacing; a puppet-agent older than the host's pkg.","solutions":["Capture the exact line: run `pkg list -Hv <package>` and compare it to the two regexes in pkg.rb.","Upgrade puppet-agent to a release supporting your pkg output format.","Make sure nothing wraps or annotates pkg stdout (aliases, sudo banners, locale settings).","Patch the regex in `parse_line` to accept the extra columns, and file the upstream issue with the offending line."],"exampleFix":"# before (pkg.rb parse_line)\nwhen %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# after - tolerate trailing columns after the IFO flags\nwhen %r{^pkg://([^/]+)/([^@]+)@(\\S+) +(...)(?:\\s.*)?$}\n  { :publisher => Regexp.last_match(1), :name => Regexp.last_match(2), :ensure => Regexp.last_match(3) }.merge ifo_flag(Regexp.last_match(4))","handlingStrategy":"validation","validationCode":"# Verify every installed line matches one of the two accepted shapes before the agent runs\npkg list -Hv | grep -Ev '^pkg://[^/]+/[^@]+@\\S+ +\\S+$' && echo \"lines pkg.rb cannot parse found\" || echo OK","typeGuard":null,"tryCatchPattern":"begin\n  provider.query\nrescue ArgumentError => e\n  raise unless e.message =~ /Unknown line format/\n  Puppet.warning(\"skipping #{resource[:name]}: unsupported pkg output\")\nend","preventionTips":["Never let wrappers, banners, or locales touch pkg stdout.","Re-run the parse check after Solaris 11.4 SRU upgrades.","Pin OS and puppet-agent versions together in release testing."],"tags":["solaris","pkg","parse-error","regex","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"}