{"record":{"id":"884a428d9a1cd2c9","repo":"puppetlabs/puppet","slug":"could-not-list-installed-packages-detail","errorCode":null,"errorMessage":"Could not list installed Packages: %{detail}","messagePattern":"Could not list installed Packages: %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/aix.rb","lineNumber":135,"sourceCode":"\n  def self.pkglist(hash = {})\n    cmd = [command(:lslpp), \"-qLc\"]\n\n    name = hash[:pkgname]\n    if name\n      cmd << name\n    end\n\n    begin\n      list = execute(cmd).scan(/^[^#][^:]*:([^:]*):([^:]*):[^:]*:[^:]*:([^:])/).collect { |n, e, s|\n        e = :absent if [:broken, :inconsistent].include?(STATE_CODE[s])\n        { :name => n, :ensure => e, :status => STATE_CODE[s], :provider => self.name }\n      }\n    rescue Puppet::ExecutionFailure => detail\n      if hash[:pkgname]\n        return nil\n      else\n        raise Puppet::Error, _(\"Could not list installed Packages: %{detail}\") % { detail: detail }, detail.backtrace\n      end\n    end\n\n    if hash[:pkgname]\n      list.shift\n    else\n      list\n    end\n  end\n\n  def self.instances\n    pkglist.collect do |hash|\n      new(hash)\n    end\n  end\n\n  def latest\n    upd = latest_info","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/aix.rb#L117-L153","documentation":"Raised by aix.rb:135 in pkglist when the command used to enumerate packages (`installp -L -d <source>` for source listings or `lslpp` for installed packages) raises Puppet::ExecutionFailure. When pkglist was called for a single package name (hash[:pkgname] set) the failure is swallowed and nil returned; only catalog-wide listings (`puppet resource package`, instances/prefetch without a specific name) raise this error with the command output as %{detail}.","triggerScenarios":"Running `puppet resource package` on AIX, or an agent run where the aix provider must enumerate instances: the underlying installp/lslpp command exits non-zero because the source depot given via `source =>` is missing/unmounted/unreadable, or lslpp is broken.","commonSituations":"NIM/lpp_source depot not mounted or moved; source path typo in the package resource; /usr/lib/objrepos corrupted so lslpp fails; permissions preventing reading the source directory.","solutions":["Run the failing listing command manually to see %{detail}: `installp -L -d <source>` or `lslpp -L -c`.","Fix or mount the source depot, or correct the `source` attribute on the package resource.","If lslpp itself fails, check /usr/lib/objrepos consistency (`lppchk -v`) before re-running puppet."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# verify the depot is listable before puppet runs\nsource = '/path/to/lpp_source'\nsystem(\"installp -L -d #{source} >/dev/null\") or raise \"installp cannot list #{source}\"","typeGuard":null,"tryCatchPattern":"begin\n  Puppet::Type.type(:package).provider(:aix).instances\nrescue Puppet::Error => e\n  raise unless e.message =~ /Could not list installed Packages/\n  # degrade to named-only checks instead of full enumeration\n  packages.each { |p| p.provider.query rescue nil }\nend","preventionTips":["Mount/verify NIM lpp_source depots before agent runs (monitor them with a health check).","Keep `source` paths stable and managed by Puppet so they cannot drift.","Run `installp -L -d <source>` in node bootstrap to catch depot problems early."],"tags":["puppet","aix","packages","command-execution"],"backgroundTag":"package-listing-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}