{"record":{"id":"680e5c65052882d0","repo":"sidekiq/sidekiq","slug":"concurrency-of-count-is-not-supported","errorCode":null,"errorMessage":"Concurrency of #{@count} is not supported","messagePattern":"Concurrency of #(.+?) is not supported","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"critical","filePath":"lib/sidekiq/manager.rb","lineNumber":29,"sourceCode":"  #\n  # 1. start: Spin up Processors.\n  # 3. processor_died: Handle job failure, throw away Processor, create new one.\n  # 4. quiet: shutdown idle Processors.\n  # 5. stop: hard stop the Processors by deadline.\n  #\n  # Note that only the last task requires its own Thread since it has to monitor\n  # the shutdown process.  The other tasks are performed by other threads.\n  #\n  class Manager\n    include Sidekiq::Component\n\n    attr_reader :workers\n    attr_reader :capsule\n\n    def initialize(capsule)\n      @config = @capsule = capsule\n      @count = capsule.concurrency\n      raise ArgumentError, \"Concurrency of #{@count} is not supported\" if @count < 1\n\n      @done = false\n      @workers = Set.new\n      @plock = Mutex.new\n      @count.times do\n        @workers << Processor.new(@config, &method(:processor_result))\n      end\n    end\n\n    def start\n      @workers.each(&:start)\n    end\n\n    def quiet\n      return if @done\n      @done = true\n\n      logger.info { \"Terminating quiet threads for #{capsule.name} capsule\" }","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/sidekiq/sidekiq/blob/1bb4aa06e5aa178a114a5e855f9f3d5c24f6c61b/lib/sidekiq/manager.rb#L11-L47","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Default the env var before casting: `config.concurrency = Integer(ENV.fetch('RAILS_MAX_THREADS', 5))`.","Pass a valid value on the command line: `bundle exec sidekiq -c 10`.","If you build capsules manually, set `capsule.concurrency = n` before the server starts.","Add a boot-time sanity check/raise in your initializer if concurrency must come from the environment."],"exampleFix":"// before\nSidekiq.configure_server do |config|\n  config.concurrency = ENV['SIDEKIQ_CONCURRENCY'].to_i # nil -> 0 -> ArgumentError\nend\n\n// after\nSidekiq.configure_server do |config|\n  config.concurrency = Integer(ENV.fetch('SIDEKIQ_CONCURRENCY', 10))\nend","handlingStrategy":"validation","validationCode":"Sidekiq.configure_server do |config|\n  concurrency = Integer(ENV.fetch('SIDEKIQ_CONCURRENCY', 10))\n  raise ArgumentError, 'concurrency must be >= 1' if concurrency < 1\n  config.concurrency = concurrency\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use bare ENV[...].to_i for concurrency — use Integer(ENV.fetch('KEY', default)).","Set required env vars in deploy manifests for every environment, and fail boot early with a clear message.","Smoke-start sidekiq in CI/staging with the same env to catch config regressions before production."],"tags":["sidekiq","configuration","concurrency","boot-error"],"backgroundTag":"invalid-config-value","analyzedSha":"1bb4aa06e5aa178a114a5e855f9f3d5c24f6c61b","analyzedAt":"2026-08-21T15:49:18.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}