{"record":{"id":"73735f4b07099a22","repo":"HangfireIO/Hangfire","slug":"no-dispatchers-registered-for-the-processing-serve","errorCode":null,"errorMessage":"No dispatchers registered for the processing server.","messagePattern":"No dispatchers registered for the processing server\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Hangfire.Core/Server/BackgroundServerProcess.cs","lineNumber":247,"sourceCode":"                    connection.RemoveServer(context.ServerId);\n                }\n\n                stopwatch.Stop();\n\n                _logger.Info($\"{GetServerTemplate(context.ServerId)} successfully reported itself as stopped in {stopwatch.Elapsed.TotalMilliseconds} ms\");\n                _logger.Info($\"{GetServerTemplate(context.ServerId)} has been stopped in total {stoppedAt?.Elapsed.TotalMilliseconds ?? 0} ms\");\n            }\n            catch (Exception ex) when (ex.IsCatchableExceptionType())\n            {\n                _logger.WarnException($\"{GetServerTemplate(context.ServerId)} there was an exception, server may not be removed\", ex);\n            }\n        }\n\n        private void StartDispatchers(BackgroundServerContext context, ICollection<IBackgroundDispatcher> dispatchers)\n        {\n            if (_dispatcherBuilders.Length == 0)\n            {\n                throw new InvalidOperationException(\"No dispatchers registered for the processing server.\");\n            }\n\n            _logger.Info($\"{GetServerTemplate(context.ServerId)} is starting the registered dispatchers: {String.Join(\", \", _dispatcherBuilders.Select(static builder => $\"{builder}\"))}...\");\n\n            foreach (var dispatcherBuilder in _dispatcherBuilders)\n            {\n                dispatchers.Add(dispatcherBuilder.Create(context, _options));\n            }\n\n            _logger.Info($\"{GetServerTemplate(context.ServerId)} all the dispatchers started\");\n        }\n\n        private void WaitForDispatchers(\n            BackgroundServerContext context,\n            IReadOnlyList<IBackgroundDispatcher> dispatchers)\n        {\n            if (dispatchers.Count == 0) return;\n","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Server/BackgroundServerProcess.cs#L229-L265","documentation":"Thrown by BackgroundServerProcess.StartDispatchers when the server was constructed with an empty dispatcher-builders array. A processing server requires at least one dispatcher (e.g. a worker) to actually execute jobs; with none, the server would idle forever, so Hangfire treats it as a configuration error.","triggerScenarios":"Constructing a BackgroundJobServer (or the underlying BackgroundServerProcess) with no dispatcher builders — e.g. an empty processes/dispatchers list, or a custom server assembly that filters out all builders.","commonSituations":"Misconfigured BackgroundJobServerOptions or a custom IBackgroundProcess that yields no dispatchers. Using the minimal server API with an empty process array. A DI registration that mistakenly provides an empty collection.","solutions":["Ensure at least one worker/dispatcher is registered — the default BackgroundJobServer adds Worker dispatchers automatically.","When using a custom server composition, include at least one IBackgroundProcessDispatcherBuilder in the builders list.","Verify the options/processes collection passed to the server constructor is non-empty."],"exampleFix":"// before\nvar server = new BackgroundJobServer(new BackgroundJobServerOptions { WorkerCount = 0 });\nserver.Start(); // throws\n\n// after\nvar server = new BackgroundJobServer(); // WorkerCount defaults to a positive value\nserver.Start();","handlingStrategy":"validation","validationCode":"var options = new BackgroundJobServerOptions { WorkerCount = Environment.ProcessorCount };\nif (options.WorkerCount <= 0) options.WorkerCount = 1;\nvar server = new BackgroundJobServer(options);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the default BackgroundJobServer constructor which registers workers automatically.","Never set WorkerCount to 0 for a processing server.","When composing a custom server, include at least one dispatcher builder."],"tags":["server","dispatcher","configuration","invalid-operation"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}