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

No configuration could be found for a client named '%{name}'

Error message

No configuration could be found for a client named '%{name}'.

What it means

Error "No configuration could be found for a client named '%{name}'." thrown in mongodb/mongoid.

Source

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

      # Create a new client given the named configuration. If no name is
      # provided, return a new client with the default configuration. If a
      # name is provided for which no configuration exists, an error will be
      # raised.
      #
      # @example Create the client.
      #   Factory.create(:analytics)
      #
      # @param [ String | Symbol ] name The named client configuration.
      #
      # @raise [ Errors::NoClientConfig ] If no config could be found.
      #
      # @return [ Mongo::Client ] The new client.
      def create(name = nil)
        return default unless name

        config = Mongoid.clients[name]
        raise Errors::NoClientConfig.new(name) unless config

        create_client(config)
      end

      # Get the default client.
      #
      # @example Get the default client.
      #   Factory.default
      #
      # @raise [ Errors::NoClientConfig ] If no default configuration is
      #   found.
      #
      # @return [ Mongo::Client ] The default client.
      def default
        create_client(Mongoid.clients[:default])
      end

      private

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/clients/factory.rb:27 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/1b2a33ce180a55e2. Report an issue: GitHub.