{"record":{"id":"e67cf52d58910c41","repo":"theforeman/foreman","slug":"name-value-is-a-type-expected-resource","errorCode":null,"errorMessage":"%{name} value is a \"%{type}\", expected \"resource\" value type","messagePattern":"%(.+?) value is a \"%(.+?)\", expected \"resource\" value type","errorType":"exception","errorClass":"Foreman::Renderer::Errors::WrongInputValueType","httpStatus":null,"severity":"error","filePath":"app/services/foreman/renderer/scope/macros/inputs.rb","lineNumber":40,"sourceCode":"            if input\n              preview? ? input.preview(self) : input.value(self)\n            else\n              raise UndefinedInput.new(s: name)\n            end\n          end\n\n          apipie :method, 'Find and returns resource object from the template input value' do\n            required :name, String, desc: 'name of the template input'\n            raises error: UndefinedInput, desc: 'when there is no input with such name defined for the current template'\n            raises error: WrongInputValueType, desc: 'when the input value type is not \"resource\"'\n            returns Object, desc: 'The resource object'\n            example 'input_resource(\"hostgroup\") #=> \"ActiveRecord object\"'\n          end\n          def input_resource(name)\n            @input = template.template_inputs&.find_by_name(name)\n\n            raise UndefinedInput.new(s: name) unless @input\n            raise WrongInputValueType.new(name: name, type: @input.value_type) if @input.value_type != 'resource'\n\n            return resource_klass.new if preview?\n            find_resource\n          end\n\n          private\n\n          def resource_klass\n            @input.resource_type.constantize\n          rescue NameError\n            raise UnknownResource.new(klass: @input.resource_type)\n          end\n\n          def resource_permission\n            \"view_#{@input.resource_type.demodulize.underscore.pluralize}\".to_sym\n          end\n\n          def find_resource","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/foreman/renderer/scope/macros/inputs.rb#L22-L58","documentation":"Error \"%{name} value is a \"%{type}\", expected \"resource\" value type\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/foreman/renderer/scope/macros/inputs.rb:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}