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

No hosts provided for client configuration: :%{name}.

Error message

No hosts provided for client configuration: :%{name}.

What it means

Error "No hosts provided for client configuration: :%{name}." thrown in mongodb/mongoid.

Source

Thrown at lib/mongoid/config/validators/client.rb:58

        def validate_client_database(name, config)
          return unless no_database_or_uri?(config)

          raise Errors::NoClientDatabase.new(name, config)
        end

        # Validate that the client config has hosts.
        #
        # @api private
        #
        # @example Validate the client has hosts.
        #   validator.validate_client_hosts(:default, {})
        #
        # @param [ String | Symbol ] name The config key.
        # @param [ Hash ] config The configuration.
        def validate_client_hosts(name, config)
          return unless no_hosts_or_uri?(config)

          raise Errors::NoClientHosts.new(name, config)
        end

        # Validate that not both a uri and standard options are provided for a
        # single client.
        #
        # @api private
        #
        # @example Validate the uri and options.
        #   validator.validate_client_uri(:default, {})
        #
        # @param [ String | Symbol ] name The config key.
        # @param [ Hash ] config The configuration.
        def validate_client_uri(name, config)
          return unless both_uri_and_standard?(config)

          raise Errors::MixedClientConfiguration.new(name, config)
        end

View on GitHub (pinned to 0da0e23d71)

When it happens

Trigger: Thrown at lib/mongoid/config/validators/client.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/5a9a22b831115db6. Report an issue: GitHub.