{"record":{"id":"80001c042cad98cb","repo":"puppetlabs/puppet","slug":"version-is-not-available-for-this-package","errorCode":null,"errorMessage":"%{version} is not available for this package","messagePattern":"%(.+?) is not available for this package","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/openbsd.rb","lineNumber":222,"sourceCode":"      regex = /^(.*)-(\\d[^-]*)-?(\\w*)(.*)$/\n      master_version = 0\n      version = -1\n\n      process.each_line do |line|\n        match = regex.match(line.split[0])\n        next unless match\n\n        # now we return the first version, unless ensure is latest\n        version = match.captures[1]\n        return version unless @resource[:ensure] == \"latest\"\n\n        master_version = version unless master_version > version\n      end\n\n      return master_version unless master_version == 0\n      return '' if version == -1\n\n      raise Puppet::Error, _(\"%{version} is not available for this package\") % { version: version }\n    end\n  rescue Puppet::ExecutionFailure\n    nil\n  end\n\n  def query\n    # Search for the version info\n    if pkginfo(@resource[:name]) =~ /Information for (inst:)?#{@resource[:name]}-(\\S+)/\n      { :ensure => Regexp.last_match(2) }\n    else\n      nil\n    end\n  end\n\n  def install_options\n    join_options(resource[:install_options])\n  end\n","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/openbsd.rb#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.).","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)."],"exampleFix":"# before\npackage { 'libreoffice': ensure => installed }  # stem not found by pkg_info -I\n\n# after\npackage { 'libreoffice': ensure => installed, flavor => 'java' }  # -> libreoffice--java\n# or pin: ensure => '7.4.2.2'","handlingStrategy":"validation","validationCode":"# confirm the stem/version is resolvable before the agent run\nout = `pkg_info -I #{stem}`\nfail \"#{stem} not found in PKG_PATH\" if out.strip.empty?","typeGuard":null,"tryCatchPattern":"begin\n  provider.send(:get_version)\nrescue Puppet::Error => e\n  raise unless e.message =~ /is not available for this package/\n  # fall back to explicit version pin from facts about installed pkg_info -Q output\n  resource[:ensure] = latest_known_version(stem); retry\nend","preventionTips":["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."],"tags":["puppet","openbsd","packages","version-resolution"],"backgroundTag":"package-version-not-available","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}