puppetlabs/puppet · error · Puppet::ExecutionFailure
Could not find package %{name}
Error message
Could not find package %{name} What it means
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.
Source
Thrown at lib/puppet/provider/package/zypper.rb:148
options << '--no-gpg-check' unless inst_opts.delete('--no-gpg-check').nil?
options << '--no-gpg-checks' unless inst_opts.delete('--no-gpg-checks').nil?
options << :install
# zypper 0.6.13 (OpenSuSE 10.2) does not support auto agree with licenses
options << '--auto-agree-with-licenses' unless major < 1 and minor <= 6 and patch <= 13
options << '--no-confirm'
options += inst_opts unless inst_opts.empty?
# Zypper 0.6.201 doesn't recognize '--name'
# It is unclear where this functionality was introduced, but it
# is present as early as 1.0.13
options << '--name' unless major < 1 || @resource.allow_virtual? || should
options << wanted
zypper(*options)
unless query
raise Puppet::ExecutionFailure, _("Could not find package %{name}") % { name: name }
end
end
# What's the latest package version available?
def latest
self.class.latest_package_version(@resource[:name]) ||
# zypper didn't find updates, pretend the current
# version is the latest
@property_hash[:ensure]
end
def update
# zypper install can be used for update, too
install
end
def uninstall
# extract version numbers and convert to integersView on GitHub (pinned to e227c27540)
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
Example fix
// before - release suffix wrong for the enabled repos
package { 'apache2':
ensure => '2.4.23-8.1',
provider => zypper,
}
// after - matches 'zypper search -s apache2' output exactly
package { 'apache2':
ensure => '2.4.23-8.3.1',
provider => zypper,
} Defensive patterns
Strategy: validation
Validate before calling
# Ruby: confirm zypper sees the exact version before puppet applies
def zypper_version_available?(name, version)
out = Puppet::Util::Execution.execute(['zypper', '--non-interactive', 'search', '-s', '--match-exact', name], failonfail: false).to_s
out.lines.any? { |l| l.split('|')[3]&.strip == version }
end Try / catch
begin
provider.install
rescue Puppet::ExecutionFailure => e
raise unless e.message =~ /Could not find package/
raise Puppet::Error, "check `zypper search -s #{resource[:name]}` - the pin must match version-release exactly"
end Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not find package %{name}
- Could not find package %{wanted}
- Could not upgrade '%{module_name}'; more recent versions not
- Could not find package %{name}
- No package found with the specified name [%{name}]
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/8f752d0340e57bc8.
Report an issue: GitHub.