{"record":{"id":"ecfbe7d14e9e1d46","repo":"theforeman/foreman","slug":"invalid-type-type","errorCode":null,"errorMessage":"Invalid type #{type}","messagePattern":"Invalid type #(.+?)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/models/concerns/foreman/sti.rb","lineNumber":9,"sourceCode":"module Foreman\n  module STI\n    extend ActiveSupport::Concern\n\n    class_methods do\n      # ensures that the correct STI object is created when :type is passed.\n      def new(attributes = nil, &block)\n        if attributes.is_a?(Hash) && (type = attributes.with_indifferent_access.delete(:type)).present? && (klass = type.constantize) != self\n          raise \"Invalid type #{type}\" unless klass <= self\n          return klass.new(attributes, &block)\n        end\n\n        super\n      end\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/concerns/foreman/sti.rb#L1-L18","documentation":"Error \"Invalid type #{type}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/concerns/foreman/sti.rb:9 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"}