mongodb/mongoid · error · Mongoid::Errors::NoClientsConfig
No clients configuration provided.
Error message
No clients configuration provided.
What it means
Raised by the private Config#clients= setter when Mongoid.configure is called with a nil or falsy clients configuration, i.e. no mongoid.yml clients section was loaded or no clients hash was passed to configure. It signals that Mongoid cannot proceed without at least one client definition.
Solutions
- Provide a clients hash containing a :default entry in mongoid.yml
- Ensure the environment key in mongoid.yml matches the current environment
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/mongoid/config.rb:527 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/ea75cda1eccb45c9.
Report an issue: GitHub.
Appendix: source
Thrown at lib/mongoid/config.rb:527
#
# @return [ true | false ] If the app is deployed on Passenger.
#
# @deprecated
def running_with_passenger?
@running_with_passenger ||= defined?(PhusionPassenger)
end
Mongoid.deprecate(self, :running_with_passenger?)
private
def set_log_levels
Mongoid.logger.level = Mongoid::Config.log_level unless defined?(::Rails)
Mongo::Logger.logger.level = Mongoid.logger.level
end
def clients=(clients)
raise Errors::NoClientsConfig.new unless clients
c = clients.with_indifferent_access
Validators::Client.validate(c)
@clients = c
end
# Get database client that respects global overrides
# Config.override_database and Config.override_client.
#
# @return [Mongo::Client] Client according to global overrides.
def global_client
client = if Threaded.client_override
Clients.with_name(Threaded.client_override)
else
Clients.default
end
if Threaded.database_override
client.use(Threaded.database_override)View on GitHub (pinned to 0da0e23d71)