puppetlabs/puppet · error · Puppet::Error
%{version} is not available for this package
Error message
%{version} is not available for this package What it means
openbsd.rb:222 (get_version): when ensure does not already contain a version, the provider runs `pkg_info -I <name>` and tries to pick a version from the listing; if the listing yields no usable version (no line matching the name-version-flavor regex that can be selected), it raises Puppet::Error '%{version} is not available for this package'. ExecutionFailure from pkg_info is swallowed (nil), so this specifically means the command ran but the package/version could not be resolved from its output.
Source
Thrown at lib/puppet/provider/package/openbsd.rb:222
regex = /^(.*)-(\d[^-]*)-?(\w*)(.*)$/
master_version = 0
version = -1
process.each_line do |line|
match = regex.match(line.split[0])
next unless match
# now we return the first version, unless ensure is latest
version = match.captures[1]
return version unless @resource[:ensure] == "latest"
master_version = version unless master_version > version
end
return master_version unless master_version == 0
return '' if version == -1
raise Puppet::Error, _("%{version} is not available for this package") % { version: version }
end
rescue Puppet::ExecutionFailure
nil
end
def query
# Search for the version info
if pkginfo(@resource[:name]) =~ /Information for (inst:)?#{@resource[:name]}-(\S+)/
{ :ensure => Regexp.last_match(2) }
else
nil
end
end
def install_options
join_options(resource[:install_options])
end
View on GitHub (pinned to e227c27540)
Solutions
- Run `pkg_info -Q <stem>` on the node to see what is actually available under the configured PKG_PATH.
- Use the exact OpenBSD stem/flavor ('vim--no_x11', not 'vim'), or pin ensure to an explicit version string that exists in the listing.
- Fix PKG_PATH/installpath if the listing is empty (points at the wrong release directory).
Example fix
# before
package { 'libreoffice': ensure => installed } # stem not found by pkg_info -I
# after
package { 'libreoffice': ensure => installed, flavor => 'java' } # -> libreoffice--java
# or pin: ensure => '7.4.2.2' Defensive patterns
Strategy: validation
Validate before calling
# confirm the stem/version is resolvable before the agent run
out = `pkg_info -I #{stem}`
fail "#{stem} not found in PKG_PATH" if out.strip.empty? Try / catch
begin provider.send(:get_version) rescue Puppet::Error => e raise unless e.message =~ /is not available for this package/ # fall back to explicit version pin from facts about installed pkg_info -Q output resource[:ensure] = latest_known_version(stem); retry end
Prevention
- Use OpenBSD stems/flavors exactly as pkg_info reports them.
- After OS release upgrades, refresh installpath to the new packages directory.
- Pin ensure to a concrete version when the mirror set is known-stable instead of relying on latest.
When it happens
Trigger: Installing with ensure => latest (or a stem without an explicit version) where pkg_info -I finds nothing parsable: wrong package stem (OpenBSD package names are stem--flavor), a version that no longer exists in the configured PKG_PATH, or an empty/incorrect installpath so the listing is empty.
Common situations: Linux-style names used on OpenBSD ('nginx' vs 'nginx--'); OpenBSD release upgrades where the mirror's package set changed; stale PKG_PATH after a version bump; flavors omitted (stem--stable etc.).
Related errors
- No valid installpath found in /etc/pkg.conf and no source wa
- You must specify a package source or configure an installpat
- Could not %{action} '%{module_name}' (%{version}); no versio
- The aix provider can only be used by root
- Could not list installed Packages: %{detail}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/80001c042cad98cb.
Report an issue: GitHub.