{"record":{"id":"8f752d0340e57bc8","repo":"puppetlabs/puppet","slug":"could-not-find-package-name-8f752d","errorCode":null,"errorMessage":"Could not find package %{name}","messagePattern":"Could not find package %(.+?)","errorType":"exception","errorClass":"Puppet::ExecutionFailure","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/zypper.rb","lineNumber":148,"sourceCode":"    options << '--no-gpg-check' unless inst_opts.delete('--no-gpg-check').nil?\n    options << '--no-gpg-checks' unless inst_opts.delete('--no-gpg-checks').nil?\n    options << :install\n\n    # zypper 0.6.13 (OpenSuSE 10.2) does not support auto agree with licenses\n    options << '--auto-agree-with-licenses' unless major < 1 and minor <= 6 and patch <= 13\n    options << '--no-confirm'\n    options += inst_opts unless inst_opts.empty?\n\n    # Zypper 0.6.201 doesn't recognize '--name'\n    # It is unclear where this functionality was introduced, but it\n    # is present as early as 1.0.13\n    options << '--name' unless major < 1 || @resource.allow_virtual? || should\n    options << wanted\n\n    zypper(*options)\n\n    unless query\n      raise Puppet::ExecutionFailure, _(\"Could not find package %{name}\") % { name: name }\n    end\n  end\n\n  # What's the latest package version available?\n  def latest\n    self.class.latest_package_version(@resource[:name]) ||\n      # zypper didn't find updates, pretend the current\n      # version is the latest\n      @property_hash[:ensure]\n  end\n\n  def update\n    # zypper install can be used for update, too\n    install\n  end\n\n  def uninstall\n    # extract version numbers and convert to integers","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/zypper.rb#L130-L166","documentation":"The zypper provider runs its composed install command and then re-queries; if rpm -q still reports nothing it raises Puppet::ExecutionFailure 'Could not find package'. The string passed to zypper is name or name-version ('--name' is suppressed when a version is pinned or virtuals are allowed), so unmatched pins, wrong release suffixes, and non-package types (patterns, srcpackages) surface here.","triggerScenarios":"ensure => '<version>' with provider => zypper where name-version does not resolve in any enabled repo or extension; managing a pattern or srcpackage name as a package; allow_virtual dropping '--name' so zypper resolves a different rpm name that query cannot match.","commonSituations":"SLES pins missing the release suffix (e.g. '.sles12'); LTSS/extension repos not enabled via SUSEConnect; versions taken from openSUSE repos applied to SLES; stale repo metadata.","solutions":["Reproduce: 'zypper --non-interactive install --name <name-version>' and read the 'not found' message","List exact candidates: 'zypper search -s --match-exact <name>' and pin to a listed version-release verbatim","Enable missing extensions ('SUSEConnect --list-extensions') or run 'zypper refresh' for stale metadata","If the target is a pattern or srcpackage, manage it as its own type rather than a package resource"],"exampleFix":"// before - release suffix wrong for the enabled repos\npackage { 'apache2':\n  ensure   => '2.4.23-8.1',\n  provider => zypper,\n}\n// after - matches 'zypper search -s apache2' output exactly\npackage { 'apache2':\n  ensure   => '2.4.23-8.3.1',\n  provider => zypper,\n}","handlingStrategy":"validation","validationCode":"# Ruby: confirm zypper sees the exact version before puppet applies\ndef zypper_version_available?(name, version)\n  out = Puppet::Util::Execution.execute(['zypper', '--non-interactive', 'search', '-s', '--match-exact', name], failonfail: false).to_s\n  out.lines.any? { |l| l.split('|')[3]&.strip == version }\nend","typeGuard":null,"tryCatchPattern":"begin\n  provider.install\nrescue Puppet::ExecutionFailure => e\n  raise unless e.message =~ /Could not find package/\n  raise Puppet::Error, \"check `zypper search -s #{resource[:name]}` - the pin must match version-release exactly\"\nend","preventionTips":["Generate SLES pins from 'zypper search -s' output, keeping the full release suffix","Keep extensions enabled via SUSEConnect and run 'zypper refresh' before agent runs","Manage patterns as patterns, not as packages, to avoid rpm -q mismatches"],"tags":["suse","zypper","package-not-found","sles","version-pin"],"backgroundTag":"package-not-found","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}