{"record":{"id":"7585554331fbe28e","repo":"mongodb/mongoid","slug":"creating-scope-name-which-conflicts-with-sel","errorCode":null,"errorMessage":"Creating scope :#{name} which conflicts with #{self.name}.#{name}. Calls to `Mongoid::Criteria##{name}` will delegate to `Mongoid::Criteria##{name}` for criteria with klass #{self.name} and will ignore the declared scope.","messagePattern":"Creating scope :#(.+?) which conflicts with #(.+?)\\.#(.+?)\\. Calls to `Mongoid::Criteria##(.+?)` will delegate to `Mongoid::Criteria##(.+?)` for criteria with klass #(.+?) and will ignore the declared scope\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/mongoid/scopable.rb","lineNumber":246,"sourceCode":"\n      private\n\n      # Warns or raises exception if overriding another scope or method.\n      #\n      # @api private\n      #\n      # @example Warn or raise error if name exists.\n      #   Model.check_scope_name(\"test\")\n      #\n      # @param [ String | Symbol ] name The name of the scope.\n      #\n      # @raise [ Errors::ScopeOverwrite ] If the name exists and configured to\n      #   raise the error.\n      def check_scope_name(name)\n        return unless _declared_scopes[name] || respond_to?(name, true)\n        raise Errors::ScopeOverwrite.new(self.name, name) if Mongoid.scope_overwrite_exception\n\n        Mongoid.logger.warn(\n          \"Creating scope :#{name} which conflicts with #{self.name}.#{name}. \" +\n          \"Calls to `Mongoid::Criteria##{name}` will delegate to \" +\n          \"`Mongoid::Criteria##{name}` for criteria with klass #{self.name} \" +\n          'and will ignore the declared scope.'\n        )\n      end\n\n      # Checks if the intended scope is a valid object, either a criteria or\n      # proc with a criteria.\n      #\n      # @api private\n      #\n      # @example Check if the scope is valid.\n      #   Model.check_scope_validity({})\n      #\n      # @param [ Object ] value The intended scope.\n      #\n      # @raise [ Errors::InvalidScope ] If the scope is not a valid object.","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/scopable.rb#L228-L264","documentation":"Error \"Creating scope :#{name} which conflicts with #{self.name}.#{name}. Calls to `Mongoid::Criteria##{name}` will delegate to `Mongoid::Criteria##{name}` for criteria with klass #{self.name} and will ignore the declared scope.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/scopable.rb:246 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"}