{"record":{"id":"8fa91f76e64b1594","repo":"abpframework/abp","slug":"no-background-job-is-registered-for-the-args-type","errorCode":null,"errorMessage":"No background job is registered for the args type '{argsType.FullName}' configured via AddDedicatedWorker. Register the job before configuring a dedicated worker for it.","messagePattern":"No background job is registered for the args type '(.+?)' configured via AddDedicatedWorker\\. Register the job before configuring a dedicated worker for it\\.","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"critical","filePath":"framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorkerManager.cs","lineNumber":106,"sourceCode":"\n        foreach (var dedicatedWorker in dedicatedWorkers)\n        {\n            await StartWorkerAsync(dedicatedWorker.LockName, BackgroundJobNameFilter.Include(dedicatedWorker.JobNames), cancellationToken);\n        }\n\n        // Default worker processes every job that is not handled by a dedicated worker.\n        await StartWorkerAsync(null, BackgroundJobNameFilter.Exclude(allDedicatedJobNames), cancellationToken);\n    }\n\n    protected virtual string GetJobName(Type argsType)\n    {\n        try\n        {\n            return JobOptions.GetJob(argsType).JobName;\n        }\n        catch (AbpException ex)\n        {\n            throw new AbpException(\n                $\"No background job is registered for the args type '{argsType.FullName}' configured via AddDedicatedWorker. \" +\n                $\"Register the job before configuring a dedicated worker for it.\", ex);\n        }\n    }\n\n    protected virtual async Task StartWorkerAsync(\n        string? distributedLockName = null,\n        BackgroundJobNameFilter? jobNameFilter = null,\n        CancellationToken cancellationToken = default)\n    {\n        var worker = ServiceProvider.GetRequiredService<IBackgroundJobWorker>();\n        await worker.StartAsync(distributedLockName, jobNameFilter, cancellationToken);\n        Workers.Add(worker);\n    }\n\n    public virtual async Task StopAsync(CancellationToken cancellationToken = default)\n    {\n        foreach (var worker in Workers)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorkerManager.cs#L88-L124","documentation":"Thrown during StartAsync when a dedicated worker is configured for an args type that has no registered background job. The manager calls JobOptions.GetJob(argsType) to resolve the job name; if no job is registered for that type, GetJob throws an AbpException that this block wraps with a clearer message telling you to register the job first. This prevents a dedicated worker from being started for a job that can never be enqueued or executed.","triggerScenarios":"Calling AddDedicatedWorker<UnregisteredJobArgs>() in ConfigureServices without first registering the job via AbpBackgroundJobOptions.AddJob<UnregisteredJobArgs>() (or the AddJob extension on the jobs options). Registering the dedicated worker in a module that runs before the module that registers the job.","commonSituations":"Adding a new job args type and configuring a dedicated worker for it but forgetting the AddJob registration. Module ordering: the dedicated worker module initializes before the job registration module. Accidentally referencing the wrong args type (a DTO that is not a registered job).","solutions":["Register the job before configuring the dedicated worker: Configure<AbpBackgroundJobOptions>(o => o.AddJob<UnregisteredJobArgs>()) in the same or an earlier-executing module.","Check module dependency order — ensure the module that calls AddJob is a [DependsOn] dependency of the module that calls AddDedicatedWorker.","Verify the args type name in the error message matches a type you actually registered; correct the type parameter if it is wrong."],"exampleFix":"// before — dedicated worker configured but job never registered\nConfigure<AbpBackgroundJobWorkerOptions>(o =>\n{\n    o.AddDedicatedWorker<EmailSendingJobArgs>(\"email-lock\");\n});\n\n// after — register the job first\nConfigure<AbpBackgroundJobOptions>(o => o.AddJob<EmailSendingJobArgs>());\nConfigure<AbpBackgroundJobWorkerOptions>(o =>\n{\n    o.AddDedicatedWorker<EmailSendingJobArgs>(\"email-lock\");\n});","handlingStrategy":"validation","validationCode":"// Ensure the job is registered before adding a dedicated worker.\nvar jobOpts = serviceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value;\ntry { jobOpts.GetJob(typeof(MyJobArgs)); }\ncatch (AbpException)\n{\n    throw new InvalidOperationException(\"Register MyJobArgs via AddJob<MyJobArgs>() before adding a dedicated worker.\");\n}\noptions.AddDedicatedWorker<MyJobArgs>(\"lock\");","typeGuard":null,"tryCatchPattern":"try { await manager.StartAsync(ct); }\ncatch (AbpException ex) when (ex.Message.Contains(\"No background job is registered for the args type\"))\n{\n    logger.LogError(ex, \"Dedicated worker configured for an unregistered job; add the missing AddJob registration.\");\n    throw;\n}","preventionTips":["Register jobs (AddJob<TArgs>) in a base/core module that always runs before the module adding dedicated workers.","Use [DependsOn] to enforce module ordering between job registration and dedicated worker configuration.","Add an integration test that starts the host to catch missing registrations early."],"tags":["background-jobs","dedicated-worker","missing-registration","startup"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}