{"record":{"id":"009b50bb11f9282e","repo":"mongodb/mongoid","slug":"errors-documentnotfound-new-klass-nil-nil","errorCode":null,"errorMessage":"Errors::DocumentNotFound.new(klass, nil, nil)","messagePattern":"Errors::DocumentNotFound\\.new\\(klass, nil, nil\\)","errorType":"exception","errorClass":"Mongoid::Errors::DocumentNotFound","httpStatus":404,"severity":"error","filePath":"lib/mongoid/contextual/none.rb","lineNumber":327,"sourceCode":"\n      # Always returns zero.\n      #\n      # @example Get the length of null context.\n      #   context.length\n      #\n      # @return [ Integer ] Always zero.\n      def length\n        entries.length\n      end\n      alias size length\n\n      alias find_first first\n      alias one first\n\n      private\n\n      def raise_document_not_found_error\n        raise Errors::DocumentNotFound.new(klass, nil, nil)\n      end\n    end\n  end\nend\n","sourceCodeStart":309,"sourceCodeEnd":332,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/contextual/none.rb#L309-L332","documentation":"Error \"Errors::DocumentNotFound.new(klass, nil, nil)\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/contextual/none.rb:327 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"}