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

No clients configuration provided.

Error message

No clients configuration provided.

What it means

Error "No clients configuration provided." thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/clients/factory.rb:58

      # @return [ Mongo::Client ] The default client.
      def default
        create_client(Mongoid.clients[:default])
      end

      private

      # Create the client for the provided config.
      #
      # @api private
      #
      # @example Create the client.
      #   Factory.create_client(config)
      #
      # @param [ Hash ] configuration The client config.
      #
      # @return [ Mongo::Client ] The client.
      def create_client(configuration)
        raise Errors::NoClientsConfig.new unless configuration

        config = configuration.dup
        uri = config.delete(:uri)
        database = config.delete(:database) || Mongo::URI.get(uri).database
        hosts = config.delete(:hosts)
        opts = config.delete(:options) || {}
        if opts.key?(:auto_encryption_options)
          opts[:auto_encryption_options] = build_auto_encryption_options(opts, database)
        end
        default_logger.warn("Unknown config options detected: #{config}.") unless config.empty?
        if uri
          Mongo::Client.new(uri, options(opts))
        else
          Mongo::Client.new(
            hosts,
            options(opts).merge(database: database)
          )
        end

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/clients/factory.rb:58 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/20e7edbc4ed2537b. Report an issue: GitHub.