mongodb/mongoid · error · Mongoid::Errors::DocumentNotFound

Errors::DocumentNotFound.new(klass, nil, nil)

Error message

Errors::DocumentNotFound.new(klass, nil, nil)

What it means

Error "Errors::DocumentNotFound.new(klass, nil, nil)" thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/contextual/none.rb:327

      # Always returns zero.
      #
      # @example Get the length of null context.
      #   context.length
      #
      # @return [ Integer ] Always zero.
      def length
        entries.length
      end
      alias size length

      alias find_first first
      alias one first

      private

      def raise_document_not_found_error
        raise Errors::DocumentNotFound.new(klass, nil, nil)
      end
    end
  end
end

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/contextual/none.rb:327 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23). Data as JSON: /api/errors/009b50bb11f9282e. Report an issue: GitHub.