{"record":{"id":"7ee56bfe7a264b29","repo":"HangfireIO/Hangfire","slug":"command","errorCode":null,"errorMessage":"command","messagePattern":"command","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Dashboard/RouteCollectionExtensions.cs","lineNumber":96,"sourceCode":"\n        public static void AddBatchCommand(\n            [NotNull] this RouteCollection routes,\n            [NotNull] string pathTemplate,\n            [NotNull] Action<DashboardContext, string> command)\n        {\n            if (routes == null) throw new ArgumentNullException(nameof(routes));\n            if (pathTemplate == null) throw new ArgumentNullException(nameof(pathTemplate));\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.Add(pathTemplate, new BatchCommandDispatcher(command));\n        }\n\n        public static void AddClientBatchCommand(\n            this RouteCollection routes,\n            string pathTemplate, \n            [NotNull] Action<IBackgroundJobClient, string> command)\n        {\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.AddBatchCommand(pathTemplate, (context, jobId) =>\n            {\n                var client = context.GetBackgroundJobClient();\n                command(client, jobId);\n            });\n        }\n\n        public static void AddRecurringBatchCommand(\n            this RouteCollection routes,\n            string pathTemplate,\n            [NotNull] Action<IRecurringJobManager, string> command)\n        {\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.AddBatchCommand(pathTemplate, (context, jobId) =>\n            {\n                var manager = context.GetRecurringJobManager();","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Dashboard/RouteCollectionExtensions.cs#L78-L114","documentation":"AddClientBatchCommand (RouteCollectionExtensions.cs:96) throws ArgumentNullException when command is null. This overload wraps a client-side Action<IBackgroundJobClient, string> into a batch command; the command delegate is required to perform the actual client operation.","triggerScenarios":"Calling routes.AddClientBatchCommand(path, null) where the Action<IBackgroundJobClient,string> delegate was not supplied.","commonSituations":"Command delegate was conditionally assigned and the branch produced null; copy-paste omission when registering dashboard batch commands.","solutions":["Provide a non-null Action<IBackgroundJobClient, string> delegate.","If the command is optional, skip the registration entirely rather than passing null."],"exampleFix":"// before\nroutes.AddClientBatchCommand(\"/requeue\", null);\n\n// after\nroutes.AddClientBatchCommand(\"/requeue\", (client, jobId) => client.Requeue(jobId));","handlingStrategy":"validation","validationCode":"if (command == null)\n    throw new ArgumentNullException(nameof(command));\nroutes.AddClientBatchCommand(\"/requeue\", command);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply a non-null Action<IBackgroundJobClient, string> delegate.","Skip registration entirely if no action is needed rather than passing null."],"tags":["dashboard","argument-null","routes","batch-command"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}