puppetlabs/puppet · error · Puppet::ExecutionFailure
Could not find package %{name}
Error message
Could not find package %{name} What it means
Raised in `install` (lib/puppet/provider/package/ports.rb:22) of Puppet's FreeBSD ports provider. It runs `portupgrade -N -M BATCH=yes <name>` and greps the output for portupgrade's `** No such ` marker; when found it converts that into Puppet::ExecutionFailure 'Could not find package', since portupgrade reports an unknown port/portorigin only in its text output.
Source
Thrown at lib/puppet/provider/package/ports.rb:22
desc "Support for FreeBSD's ports. Note that this, too, mixes packages and ports."
commands :portupgrade => "/usr/local/sbin/portupgrade",
:portversion => "/usr/local/sbin/portversion",
:portuninstall => "/usr/local/sbin/pkg_deinstall",
:portinfo => "/usr/sbin/pkg_info"
%w[INTERACTIVE UNAME].each do |var|
ENV.delete(var) if ENV.include?(var)
end
def install
# -N: install if the package is missing, otherwise upgrade
# -M: yes, we're a batch, so don't ask any questions
cmd = %w[-N -M BATCH=yes] << @resource[:name]
output = portupgrade(*cmd)
if output =~ /\*\* No such /
raise Puppet::ExecutionFailure, _("Could not find package %{name}") % { name: @resource[:name] }
end
end
# If there are multiple packages, we only use the last one
def latest
cmd = ["-v", @resource[:name]]
begin
output = portversion(*cmd)
rescue Puppet::ExecutionFailure => e
raise Puppet::Error.new(output, e)
end
line = output.split("\n").pop
unless line =~ /^(\S+)\s+(\S)\s+(.+)$/
# There's no "latest" version, so just return a placeholder
return :latest
endView on GitHub (pinned to e227c27540)
Solutions
- Find the correct origin: `whereis <name>` or `make -C /usr/ports search name=<name>`.
- Use the origin form `mail/postfix` in the resource title when the bare name fails.
- Update the ports tree (`portsnap fetch update`) and rerun the agent.
- If the port was moved, update the manifest to its new location per UPDATING.
Example fix
# before
package { 'postfix':
ensure => installed,
provider => ports,
}
# after - use the port origin
package { 'mail/postfix':
ensure => installed,
provider => ports,
} Defensive patterns
Strategy: validation
Validate before calling
# Confirm the port origin exists before declaring the resource
whereis -q "${name}" | grep -q . || make -C /usr/ports search name="${name}" >/dev/null || echo "no such port - fix the title to category/port" Prevention
- Use port origins (`mail/postfix`) as resource titles with the ports provider.
- Keep portsnap current so origins match reality.
- Track /usr/ports/UPDATING and MOVED for renamed ports.
When it happens
Trigger: A package title that names no known port or origin: typos, using a pkg-plist name instead of the port origin, a ports tree that lacks the port, or a stale INDEX after ports moved.
Common situations: Ports renamed/moved (see /usr/ports/UPDATING and MOVED); portsnap not run so the tree is old; manifests written with binary package names instead of `category/port` origins.
Related errors
- Could not find package %{name}
- Could not match package info '%{pkgstuff}'
- Could not match version info '%{info}'
- Unexpected output from portversion: %{output}
- Could not find package %{name}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/3d822ef2749c64d1.
Report an issue: GitHub.