{"record":{"id":"f76e5643dd086b41","repo":"mongodb/mongoid","slug":"eager-loading-only-supports-arguments-that-are-the","errorCode":null,"errorMessage":"Eager loading only supports arguments that are the names of associations on #{klass}","messagePattern":"Eager loading only supports arguments that are the names of associations on #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/mongoid/criteria/includable.rb","lineNumber":141,"sourceCode":"      # @param [ Class ] parent_class The class to start the lookup from.\n      # @param [ Symbol | String ] relation The association name.\n      # @param [ Boolean ] is_eager_load Whether to consider subclasses.\n      #\n      # @return [ Array<Mongoid::Association::Relatable> ] Matching associations.\n      def resolve_inclusion_associations(parent_class, relation, is_eager_load)\n        if association = parent_class.reflect_on_association(relation)\n          return [ association ]\n        end\n\n        return [] unless is_eager_load\n\n        parent_class.descendants.filter_map { |sub| sub.reflect_on_association(relation) }\n      end\n    end\n\n    def raise_eager_error(is_eager_load, klass, relation)\n      if is_eager_load\n        raise ArgumentError, \"Eager loading only supports arguments that are the names of associations on #{klass}\"\n      end\n\n      raise Errors::InvalidIncludes.new(klass, [ relation ])\n    end\n  end\nend\n","sourceCodeStart":123,"sourceCodeEnd":148,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/criteria/includable.rb#L123-L148","documentation":"Error \"Eager loading only supports arguments that are the names of associations on #{klass}\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/criteria/includable.rb:141 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":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}