puppetlabs/puppet · error · ArgumentError
Unknown line format %{resource_name}: %{parse_line}
Error message
Unknown line format %{resource_name}: %{parse_line} What it means
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.
Source
Thrown at lib/puppet/provider/package/pkg.rb:115
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
raise ArgumentError, _('Unknown line format %{resource_name}: %{parse_line}') % { resource_name: name, parse_line: line }
end).merge({ :provider => name })
end
def hold
pkg(:freeze, @resource[:name])
end
def unhold
r = exec_cmd(command(:pkg), 'unfreeze', @resource[:name])
raise Puppet::Error, _("Unable to unfreeze %{package}") % { package: r[:out] } unless [0, 4].include? r[:exit]
end
def insync?(is)
# this is called after the generic version matching logic (insync? for the
# type), so we only get here if should != is, and 'should' is a version
# number. 'is' might not be, though.
should = @resource[:ensure]
# NB: it is apparently possible for repository administrators to publishView on GitHub (pinned to e227c27540)
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.
Example fix
# before (pkg.rb parse_line)
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))
# after - tolerate trailing columns after the IFO flags
when %r{^pkg://([^/]+)/([^@]+)@(\S+) +(...)(?:\s.*)?$}
{ :publisher => Regexp.last_match(1), :name => Regexp.last_match(2), :ensure => Regexp.last_match(3) }.merge ifo_flag(Regexp.last_match(4)) Defensive patterns
Strategy: validation
Validate before calling
# Verify every installed line matches one of the two accepted shapes before the agent runs pkg list -Hv | grep -Ev '^pkg://[^/]+/[^@]+@\S+ +\S+$' && echo "lines pkg.rb cannot parse found" || echo OK
Try / catch
begin
provider.query
rescue ArgumentError => e
raise unless e.message =~ /Unknown line format/
Puppet.warning("skipping #{resource[:name]}: unsupported pkg output")
end Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown format %{resource_name}: %{state}
- Format specifiers %L and %N denotes fractions and must be us
- Unable to parse '%{timespan}' using format '%{format}'
- Bad format specifier '%{expression}' in '%{format}', at posi
- Unable to parse '%{str}' using any of the formats %{formats}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/fedadc2559728a2b.
Report an issue: GitHub.