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

Invalid global_executor_concurrency option.

Error message

Invalid global_executor_concurrency option.

What it means

The async query executor validator rejects the configuration when async_query_executor is :global_thread_pool but global_executor_concurrency is missing or invalid. The concurrency value is required for the global thread pool executor.

Solutions

  1. Set Mongoid.global_executor_concurrency to a positive integer
  2. Use async_query_executor :immediate, which needs no concurrency setting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/mongoid/config/validators/async_query_executor.rb:25 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/1f92cb1960c4aa18. Report an issue: GitHub.

Appendix: source

Thrown at lib/mongoid/config/validators/async_query_executor.rb:25

      # configuration. Used during application bootstrapping.
      #
      # @api private
      module AsyncQueryExecutor
        extend self

        # Validate the Mongoid configuration options related to
        # the async query executor.
        #
        # @param [ Hash ] options The configuration options.
        #
        # @raises [ Mongoid::Errors::InvalidGlobalExecutorConcurrency ]
        #   Raised if the options are invalid.
        #
        # @api private
        def validate(options)
          return unless options.key?(:async_query_executor)
          if options[:async_query_executor].to_sym == :immediate && !options[:global_executor_concurrency].nil?
            raise Errors::InvalidGlobalExecutorConcurrency
          end
        end
      end
    end
  end
end

View on GitHub (pinned to 0da0e23d71)