sidekiq/sidekiq · critical · ArgumentError

Concurrency of #{@count} is not supported

Error message

Concurrency of #{@count} is not supported

What it means

The processor Manager spawns one thread per unit of concurrency, so `Sidekiq::Manager#initialize` requires `capsule.concurrency >= 1` and raises ArgumentError otherwise. Concurrency comes from `Sidekiq.configure_server { |c| c.concurrency = ... }` (or per-capsule config); 0 or negative means no workers could run, which is almost always a misconfiguration.

Source

Thrown at lib/sidekiq/manager.rb:29

  #
  # 1. start: Spin up Processors.
  # 3. processor_died: Handle job failure, throw away Processor, create new one.
  # 4. quiet: shutdown idle Processors.
  # 5. stop: hard stop the Processors by deadline.
  #
  # Note that only the last task requires its own Thread since it has to monitor
  # the shutdown process.  The other tasks are performed by other threads.
  #
  class Manager
    include Sidekiq::Component

    attr_reader :workers
    attr_reader :capsule

    def initialize(capsule)
      @config = @capsule = capsule
      @count = capsule.concurrency
      raise ArgumentError, "Concurrency of #{@count} is not supported" if @count < 1

      @done = false
      @workers = Set.new
      @plock = Mutex.new
      @count.times do
        @workers << Processor.new(@config, &method(:processor_result))
      end
    end

    def start
      @workers.each(&:start)
    end

    def quiet
      return if @done
      @done = true

      logger.info { "Terminating quiet threads for #{capsule.name} capsule" }

View on GitHub (pinned to 1bb4aa06e5)

Solutions

  1. Default the env var before casting: `config.concurrency = Integer(ENV.fetch('RAILS_MAX_THREADS', 5))`.
  2. Pass a valid value on the command line: `bundle exec sidekiq -c 10`.
  3. If you build capsules manually, set `capsule.concurrency = n` before the server starts.
  4. Add a boot-time sanity check/raise in your initializer if concurrency must come from the environment.

Example fix

// before
Sidekiq.configure_server do |config|
  config.concurrency = ENV['SIDEKIQ_CONCURRENCY'].to_i # nil -> 0 -> ArgumentError
end

// after
Sidekiq.configure_server do |config|
  config.concurrency = Integer(ENV.fetch('SIDEKIQ_CONCURRENCY', 10))
end
Defensive patterns

Strategy: validation

Validate before calling

Sidekiq.configure_server do |config|
  concurrency = Integer(ENV.fetch('SIDEKIQ_CONCURRENCY', 10))
  raise ArgumentError, 'concurrency must be >= 1' if concurrency < 1
  config.concurrency = concurrency
end

Prevention

When it happens

Trigger: Setting `config.concurrency = ENV['RAILS_MAX_THREADS'].to_i` when the env var is unset/blank (nil.to_i or ''.to_i == 0). Starting sidekiq with `-c 0`. Creating a custom capsule via `config.capsules['name'] = Sidekiq::Capsule.new('name', config)` with concurrency left at 0 or set negative. The raise happens at server boot (Launcher builds the Manager).

Common situations: Docker/Kubernetes deployments where the RAILS_MAX_THREADS/SIDEKIQ_CONCURRENCY env var is missing in one environment. Copying config between apps that use different env var names. Embedding Sidekiq and constructing capsules manually without setting concurrency.

Related errors


AI-assisted analysis of sidekiq/sidekiq@1bb4aa06e5 (2026-08-21). Data as JSON: /api/errors/680e5c65052882d0. Report an issue: GitHub.