{"record":{"id":"1be55c2e9c99d0d0","repo":"theforeman/foreman","slug":"type-is-not-interface-class","errorCode":null,"errorMessage":"Type is not Interface class","messagePattern":"Type is not Interface class","errorType":"exception","errorClass":"Foreman::Exception","httpStatus":500,"severity":"error","filePath":"app/controllers/interfaces_controller.rb","lineNumber":21,"sourceCode":"\n  # params structure is\n  #   {\"host\"=>\n  #     {\"interfaces_attributes\"=>\n  #       {\"1405068143746\"=>\n  #         {\"_destroy\"=>\"false\", \"type\"=>\"Nic::BMC\", \"mac\"=>\"\", \"name\"=>\"\", \"domain_id\"=>\"\", \"ip\"=>\"\"}}}}\n  def new\n    safe_params = host_params('host')\n    @host = Host.new(safe_params)\n\n    attributes = safe_params.fetch(:interfaces_attributes, {})\n    @key, attributes = attributes.to_h.first\n    raise Foreman::Exception, 'Missing attributes for interface' if @key.blank?\n\n    if attributes.present?\n      raise Foreman::Exception, 'Type was not selected' if attributes['type'].blank?\n\n      klass = attributes.delete('type').constantize\n      raise Foreman::Exception, 'Type is not Interface class' unless klass <= Nic::Base\n\n      attributes.delete('_destroy')\n      @interface = klass.new(attributes)\n    end\n\n    render 'nic/new'\n  end\n\n  def random_name\n    render :json => { :name => NameGenerator.new.next_mac_name(params[:mac]) }\n  rescue ActionView::Template::Error => exception\n    process_ajax_error exception, 'generate random name'\n  end\n\n  def action_permission\n    case params[:action]\n      when 'random_name'\n        :edit","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/controllers/interfaces_controller.rb#L3-L39","documentation":"Error \"Type is not Interface class\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/controllers/interfaces_controller.rb:21 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"}