puppetlabs/puppet · error · ArgumentError

Unknown format %{resource_name}: %{state}

Error message

Unknown format %{resource_name}: %{state}

What it means

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.

Source

Thrown at lib/puppet/provider/package/pkg.rb:96

  # Frozen was never implemented in UFOXI so skipping frozen here.
  def self.ufoxi_flag(flags)
    {}
  end

  # pkg state was present in the older version of pkg (with UFOXI) but is
  # no longer available with the IFO field version. When it was present,
  # it was used to indicate that a particular version was present (installed)
  # and later versions were known. Note that according to the pkg man page,
  # known never lists older versions of the package. So we can rely on this
  # field to make sure that if a known is present, then the pkg is upgradable.
  def self.pkg_state(state)
    case state
    when /installed/
      { :status => 'installed' }
    when /known/
      { :status => 'known' }
    else
      raise ArgumentError, _('Unknown format %{resource_name}: %{state}') % { resource_name: name, state: state }
    end
  end

  # Here is (hopefully) the only place we will have to deal with multiple
  # formats of output for different pkg versions.
  def self.parse_line(line)
    (case line.chomp
     # FMRI                                                                         IFO
     # pkg://omnios/SUNWcs@0.5.11,5.11-0.151008:20131204T022241Z                    ---
     when %r{^pkg://([^/]+)/([^@]+)@(\S+) +(...)$}
       { :publisher => Regexp.last_match(1), :name => Regexp.last_match(2), :ensure => Regexp.last_match(3) }.merge ifo_flag(Regexp.last_match(4))

     # FMRI                                                             STATE      UFOXI
     # pkg://solaris/SUNWcs@0.5.11,5.11-0.151.0.1:20101105T001108Z      installed  u----
     when %r{^pkg://([^/]+)/([^@]+)@(\S+) +(\S+) +(.....)$}
       { :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)))

     else

View on GitHub (pinned to e227c27540)

Solutions

  1. Run `pkg list -Hv <package>` to see the exact STATE column value the provider choked on.
  2. 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.
  3. Upgrade puppet-agent; newer releases track additional pkg formats.
  4. Update the boot environment (`pkg update`) so the host emits the modern IFO format the provider handles best.
Defensive patterns

Strategy: validation

Validate before calling

# Force C locale for pkg and precheck the STATE column on legacy-format hosts
export LANG=C LC_ALL=C
pkg list -Hv <name> | awk '{ print $(NF-1) }' | grep -Eq 'installed|known' || echo "unparseable state - do not run puppet yet"

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


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