puppetlabs/puppet · error · ArgumentError
Only Runtime type 'ruby' is supported, got #{type.runtime}
Error message
Only Runtime type 'ruby' is supported, got #{type.runtime} What it means
Puppet's ClassLoader resolves a Puppet `Runtime[runtime, 'ClassName']` type reference into a live Ruby constant. Only the 'ruby' runtime is implemented: provide_from_type raises ArgumentError whenever a PRuntimeType names any other runtime, before any load is attempted. This is a hard capability limit of the PCore type system, not a missing dependency.
Source
Thrown at lib/puppet/pops/types/class_loader.rb:40
case name
when String
provide_from_string(name)
when Array
provide_from_name_path(name.join('::'), name)
when PAnyType, PTypeType
provide_from_type(name)
else
raise ArgumentError, "Cannot provide a class from a '#{name.class.name}'"
end
end
def self.provide_from_type(type)
case type
when PRuntimeType
raise ArgumentError, "Only Runtime type 'ruby' is supported, got #{type.runtime}" unless type.runtime == :ruby
provide_from_string(type.runtime_type_name)
when PBooleanType
# There is no other thing to load except this Enum meta type
RGen::MetamodelBuilder::MMBase::Boolean
when PTypeType
# TODO: PTypeType should have a type argument (a PAnyType) so the Class' class could be returned
# (but this only matters in special circumstances when meta programming has been used).
Class
when POptionalType
# cannot make a distinction between optional and its type
provide_from_type(type.optional_type)
# Although not expected to be the first choice for getting a concrete class for these
# types, these are of value if the calling logic just has a reference to type.View on GitHub (pinned to e227c27540)
Solutions
- Change the runtime parameter to 'ruby' (Runtime['ruby', 'MyClass']) — no other runtime is loadable.
- If you need a non-Ruby facility, call it from Ruby code wrapped in a Puppet function, or use an external tool, instead of a Runtime type.
- In Ruby code that builds PRuntimeType dynamically, assert runtime == :ruby (or pass the default) before calling ClassLoader.provide.
Example fix
# before $cls = Runtime['java', 'com.example.Thing'] # after $cls = Runtime['ruby', 'Set']
Defensive patterns
Strategy: validation
Validate before calling
# Ruby — before resolving a Runtime type
unless type.is_a?(Puppet::Pops::Types::PRuntimeType) && type.runtime == :ruby
raise ArgumentError, "only Runtime['ruby', <class>] is resolvable, got #{type.runtime.inspect}"
end
Puppet::Pops::Types::ClassLoader.provide(type) Type guard
def ruby_runtime_type?(t) t.is_a?(Puppet::Pops::Types::PRuntimeType) && t.runtime == :ruby end
Try / catch
begin
Puppet::Pops::Types::ClassLoader.provide(rt)
rescue ArgumentError => e
raise NotImplementedError, "runtime #{rt.runtime} not supported: #{e.message}"
end Prevention
- Treat Runtime[...] as Ruby-only in Puppet manifests and code review it as such.
- Never build PRuntimeType from user/config input without whitelisting the runtime as :ruby.
When it happens
Trigger: Evaluating a `Runtime[...]` type whose first parameter is not 'ruby' anywhere a class must be produced: a Puppet DSL expression like Runtime['java', 'Foo'] used in a function signature or passed to ClassLoader, or Ruby code calling Puppet::Pops::Types::ClassLoader.provide(PRuntimeType.new(:java, 'Foo')).
Common situations: Copying Runtime type examples from other JVM/polyglot tooling into Puppet code; typos like Runtime['rb', ...] or 'JRUBY'; custom Ruby extensions that build PRuntimeType programmatically with a symbol other than :ruby; upstream code written against a Puppet version that was expected to gain other runtimes.
Related errors
- Init cannot be parameterized with an undefined type and addi
- Creation of new instance of type '%{type_name}' is not suppo
- The type '%{type}' does not represent a valid set of paramet
- Illegal format '#{actual}' specified for value of Runtime ty
- Data Type Load Error for type '%{type_name}': %{message}
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/0804d0015ba80862.
Report an issue: GitHub.