puppetlabs/puppet · error · Puppet::Error

Could not find type %{request_type}

Error message

Could not find type %{request_type}

What it means

The RAL resource terminus (used by 'puppet resource' and REST resource queries) splits the request key on the first '/' into type and title, then looks up Puppet::Type.type(type_name). If no resource type is registered under that name, Puppet::Error is raised. Unregistered means: the type name is misspelled or wrongly cased for namespaced types, or a custom type's plugin (custom type/provider ruby files) has not been synced/loaded on this host.

Source

Thrown at lib/puppet/indirector/resource/ral.rb:64

  end

  private

  # {type,resource}_name: the resource name may contain slashes:
  # File["/etc/hosts"]. To handle, assume the type name does
  # _not_ have any slashes in it, and split only on the first.

  def type_name(request)
    request.key.split('/', 2)[0]
  end

  def resource_name(request)
    name = request.key.split('/', 2)[1]
    name unless name == ""
  end

  def type(request)
    Puppet::Type.type(type_name(request)) or raise Puppet::Error, _("Could not find type %{request_type}") % { request_type: type_name(request) }
  end
end

View on GitHub (pinned to e227c27540)

Solutions

  1. Check available types: puppet resource --types | grep -i <name> to confirm spelling/availability
  2. Run an agent pass (puppet agent -t) or puppet plugin download so custom types under modules' lib/ are synced before querying
  3. For namespaced types, use the exact casing: File_line vs file_line per the type's newtype declaration
  4. Ensure modulepath on the host includes the module providing the type (puppet config print modulepath)

Example fix

# before
puppet resource apache::vhost web  # type never synced to this node
# Error: Could not find type apache::vhost

# after
puppet agent -t                  # pluginsync brings lib/puppet/type/*
puppet resource apache::vhost web
Defensive patterns

Strategy: validation

Validate before calling

type_name, title = key.split('/', 2)
unless Puppet::Type.type(type_name)
  raise ArgumentError, "resource type '#{type_name}' not loaded on this host (run puppet agent -t to pluginsync)"
end

Type guard

def known_resource_type?(name)
  !Puppet::Type.type(name.to_s.split('/', 2)[0]).nil?
end

Prevention

When it happens

Trigger: Running puppet resource <type> ... where <type> does not exist: 'puppet resource pakage' (typo), 'puppet resource apache::vhost foo' where the module's lib/puppet/type files were never pluginsynced to this node, or REST calls to /puppet/v3/resource/<bogus>/... against an agent.

Common situations: Custom types used before the first agent run completes pluginsync; environments where modules live in a nonstandard modulepath not present on the querying host; case errors (Package vs package is fine, but namespaced types must match exactly); querying resource via REST on a node lacking the module.

Related errors


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