{"record":{"id":"09d0e6509fded681","repo":"puppetlabs/puppet","slug":"no-valid-installpath-found-in-etc-pkg-conf-and-no","errorCode":null,"errorMessage":"No valid installpath found in /etc/pkg.conf and no source was set","messagePattern":"No valid installpath found in /etc/pkg\\.conf and no source was set","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/openbsd.rb","lineNumber":143,"sourceCode":"      if Puppet::FileSystem.exist?(\"/etc/pkg.conf\")\n        File.open(\"/etc/pkg.conf\", \"rb\").readlines.each do |line|\n          matchdata = line.match(/^installpath\\s*=\\s*(.+)\\s*$/i)\n          if matchdata\n            @resource[:source] = matchdata[1]\n          else\n            matchdata = line.match(/^installpath\\s*\\+=\\s*(.+)\\s*$/i)\n            if matchdata\n              if @resource[:source].nil?\n                @resource[:source] = matchdata[1]\n              else\n                @resource[:source] += \":\" + matchdata[1]\n              end\n            end\n          end\n        end\n\n        unless @resource[:source]\n          raise Puppet::Error,\n                _(\"No valid installpath found in /etc/pkg.conf and no source was set\")\n        end\n      else\n        raise Puppet::Error,\n              _(\"You must specify a package source or configure an installpath in /etc/pkg.conf\")\n      end\n    end\n  end\n\n  def install(latest = false)\n    cmd = []\n\n    parse_pkgconf\n\n    if @resource[:source][-1, 1] == ::File::SEPARATOR\n      e_vars = { 'PKG_PATH' => @resource[:source] }\n      full_name = get_full_name(latest)\n    else","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/openbsd.rb#L125-L161","documentation":"openbsd.rb:143 (parse_pkgconf): when the package resource has no source and /etc/pkg.conf exists but contains no usable installpath (= or +=) line, the provider raises Puppet::Error. On OpenBSD, pkg_add needs PKG_PATH or a source; installpath in pkg.conf is how that is usually provided, so an empty/fragmentary pkg.conf leaves nothing to install from.","triggerScenarios":"package { X: ensure => installed } on OpenBSD with no source attribute and an /etc/pkg.conf that lacks any `installpath = ...` or `installpath += ...` line (e.g. a stock file that only has other settings commented in).","commonSituations":"Fresh OpenBSD installs where installpath was never configured; pkg.conf edited and installpath removed; using snapshots requiring explicit paths.","solutions":["Set installpath in /etc/pkg.conf (manage the file via Puppet's augeas/file resources), e.g. `installpath = ftp.openbsd.org/pub/OpenBSD/7.4/packages/%a`.","Or give each package resource an explicit source (URL or directory ending in '/') so pkg.conf is not consulted.","Keep the pkg.conf resource ordered before any Package resource that depends on it."],"exampleFix":"# before\nfile { '/etc/pkg.conf': ensure => present, content => \"\\n\" }\npackage { 'vim--no_x11': ensure => installed }\n\n# after\nfile { '/etc/pkg.conf': ensure => present, content => \"installpath = https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(arch -s)\\n\", before => Package['vim--no_x11'] }\npackage { 'vim--no_x11': ensure => installed }","handlingStrategy":"validation","validationCode":"# pkg.conf exists — confirm it actually yields an installpath\nlines = File.readlines('/etc/pkg.conf')\nhas_ip = lines.any? { |l| l =~ /^installpath\\s*(=|\\+=)/i }\nraise 'no installpath in /etc/pkg.conf; set source or fix pkg.conf' unless has_ip || resource_source_set?","typeGuard":null,"tryCatchPattern":"begin\n  provider.send(:parse_pkgconf)\nrescue Puppet::Error => e\n  raise unless e.message.include?('installpath')\n  resource[:source] = 'https://ftp.openbsd.org/pub/OpenBSD/7.4/packages/%a/'; retry\nend","preventionTips":["Manage /etc/pkg.conf with Puppet and assert an installpath line exists in its content template tests.","Set explicit per-package source attributes when you cannot rely on pkg.conf.","Order pkg.conf management before any OpenBSD Package resource."],"tags":["puppet","openbsd","packages","repository-config"],"backgroundTag":"package-source-misconfigured","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}