theforeman/foreman · error · Foreman::Renderer::Errors::WrongInputValueType

%{name} value is a "%{type}", expected "resource" value type

Error message

%{name} value is a "%{type}", expected "resource" value type

What it means

Error "%{name} value is a "%{type}", expected "resource" value type" thrown in theforeman/foreman.

Source

Thrown at app/services/foreman/renderer/scope/macros/inputs.rb:40

            if input
              preview? ? input.preview(self) : input.value(self)
            else
              raise UndefinedInput.new(s: name)
            end
          end

          apipie :method, 'Find and returns resource object from the template input value' do
            required :name, String, desc: 'name of the template input'
            raises error: UndefinedInput, desc: 'when there is no input with such name defined for the current template'
            raises error: WrongInputValueType, desc: 'when the input value type is not "resource"'
            returns Object, desc: 'The resource object'
            example 'input_resource("hostgroup") #=> "ActiveRecord object"'
          end
          def input_resource(name)
            @input = template.template_inputs&.find_by_name(name)

            raise UndefinedInput.new(s: name) unless @input
            raise WrongInputValueType.new(name: name, type: @input.value_type) if @input.value_type != 'resource'

            return resource_klass.new if preview?
            find_resource
          end

          private

          def resource_klass
            @input.resource_type.constantize
          rescue NameError
            raise UnknownResource.new(klass: @input.resource_type)
          end

          def resource_permission
            "view_#{@input.resource_type.demodulize.underscore.pluralize}".to_sym
          end

          def find_resource

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/services/foreman/renderer/scope/macros/inputs.rb:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/e67cf52d58910c41. Report an issue: GitHub.