{"record":{"id":"bb6e404b55fda44b","repo":"puppetlabs/puppet","slug":"unknown-format-resource-name-full-flags-b","errorCode":null,"errorMessage":"Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]","messagePattern":"Unknown format %(.+?): %(.+?)\\[%(.+?)\\]","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/pkg.rb","lineNumber":55,"sourceCode":"  def self.instances\n    pkg(:list, '-Hv').split(\"\\n\").map { |l| new(parse_line(l)) }\n  end\n\n  # The IFO flag field is just what it names, the first field can have either\n  # i_nstalled or -, and second field f_rozen or -, and last\n  # o_bsolate or r_rename or -\n  # so this checks if the installed field is present, and also verifies that\n  # if not the field is -, else we don't know what we are doing and exit with\n  # out doing more damage.\n  def self.ifo_flag(flags)\n    (\n      case flags[0..0]\n      when 'i'\n        { :status => 'installed' }\n      when '-'\n        { :status => 'known' }\n      else\n        raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %\n            { resource_name: name, full_flags: flags, bad_flag: flags[0..0] }\n      end\n    ).merge(\n      case flags[1..1]\n      when 'f'\n        { :mark => :hold }\n      when '-'\n        {}\n      else\n        raise ArgumentError, _('Unknown format %{resource_name}: %{full_flags}[%{bad_flag}]') %\n            { resource_name: name, full_flags: flags, bad_flag: flags[1..1] }\n      end\n    )\n  end\n\n  # The UFOXI field is the field present in the older pkg\n  # (solaris 2009.06 - snv151a)\n  # similar to IFO, UFOXI is also an either letter or -","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/pkg.rb#L37-L73","documentation":"pkg.rb:55 (ifo_flag): while parsing `pkg list` style output, the provider maps the two-character flags column: position 0 must be 'i' (installed) or '-' (known), position 1 must be 'f' (hold/variant frozen) or '-'. Any other character raises ArgumentError 'Unknown format ...' with the offending flag, deliberately refusing to guess (as the comment says, avoid doing damage with output the parser does not understand).","triggerScenarios":"Enumerating or prefetching packages with the pkg provider (Solaris 11/OpenIndiana/omnios) when pkg emits a flags character this Puppet version does not know — newer pkg(5) versions added flag meanings (e.g. 'v' variant-frozen, 'o' obsolete, 'r' renamed) that older Puppet's parser rejects.","commonSituations":"Older Puppet agent on a newer Solaris 11 SR/illumos distro after pkg was updated; `puppet resource package` or a catalog with any pkg-managed package triggering instances/prefetch on those hosts.","solutions":["Check the actual flags column: `pkg list -H --no_headers` style output; identify the unknown character (v/o/r on newer pkg).","Upgrade the puppet agent to a release whose pkg provider understands the new flags (this parser was extended in later Puppet versions).","As a stopgap, avoid the pkg provider for enumeration (don't run `puppet resource package`) and manage only explicitly named packages, or hold the pkg version until puppet is upgraded."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# only feed well-formed flags to the provider path\nflags = line.split[1] # e.g. 'if'\nraise \"unparseable pkg flags #{flags}\" unless flags =~ /^[i-][f-]$/","typeGuard":"def known_pkg_flags?(flags)\n  flags.is_a?(String) && flags.length == 2 && flags[0] =~ /[i-]/ && flags[1] =~ /[f-]/\nend","tryCatchPattern":"begin\n  Puppet::Type.type(:package).provider(:pkg).instances\nrescue ArgumentError => e\n  raise unless e.message =~ /Unknown format/\n  # newer pkg emits unknown flags: skip enumeration rather than corrupting state\n  Puppet.err(\"pkg flag parse failed: #{e.message}\"); []\nend","preventionTips":["Keep the puppet agent current on Solaris 11/illumos hosts — new pkg flags require new parsers.","Avoid `puppet resource package` sweeps on hosts whose pkg version outpaces the agent.","Track pkg SR updates in change management together with puppet agent upgrades."],"tags":["puppet","solaris","pkg","packages","output-parsing"],"backgroundTag":"output-parsing-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}