puppetlabs/puppet · error · Puppet::Error

Mac OS X PKG DMGs must specify a package name.

Error message

Mac OS X PKG DMGs must specify a package name.

What it means

Raised by `install` (lib/puppet/provider/package/pkgdmg.rb:154) when `@resource[:name]` is nil. In practice Puppet always populates a package resource's name from its title, so this guard is effectively unreachable from normal manifests; hitting it means the resource was constructed programmatically without a name.

Source

Thrown at lib/puppet/provider/package/pkgdmg.rb:154

  def query
    if Puppet::FileSystem.exist?("/var/db/.puppet_pkgdmg_installed_#{@resource[:name]}")
      Puppet.debug "/var/db/.puppet_pkgdmg_installed_#{@resource[:name]} found"
      { :name => @resource[:name], :ensure => :present }
    else
      nil
    end
  end

  def install
    source = @resource[:source]
    unless source
      raise Puppet::Error, _("Mac OS X PKG DMGs must specify a package source.")
    end

    name = @resource[:name]
    unless name
      raise Puppet::Error, _("Mac OS X PKG DMGs must specify a package name.")
    end

    self.class.installpkgdmg(source, name)
  end
end

View on GitHub (pinned to e227c27540)

Solutions

  1. Ensure every `package` resource using pkgdmg has a real title/name.
  2. Audit custom code that builds resources dynamically for nil names.
Defensive patterns

Strategy: validation

Validate before calling

# Ensure programmatically built resources always carry a title
fail('package resource requires a name') if $title =~ Undef

Prevention

When it happens

Trigger: Code creating a package resource object without a title/name (custom Ruby types or direct provider instantiation), or a nil title coming out of generated catalogs.

Common situations: Programmatic catalog generation bugs; almost never seen in hand-written manifests.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/8c4a8bcf86eba6e5. Report an issue: GitHub.