{"record":{"id":"e42d47f77bdcbd01","repo":"abpframework/abp","slug":"background-job-execution-is-disabled-this-method","errorCode":null,"errorMessage":"Background job execution is disabled. This method should not be called! If you want to enable the background job execution, set AbpBackgroundJobOptions.IsJobExecutionEnabled to true! If you've intentionally disabled job execution and this seems to be a bug, please report it.","messagePattern":"Background job execution is disabled\\. This method should not be called! If you want to enable the background job execution, set AbpBackgroundJobOptions\\.IsJobExecutionEnabled to true! If you've intentionally disabled job execution and this seems to be a bug, please report it\\.","errorType":"exception","errorClass":"AbpException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs","lineNumber":44,"sourceCode":"        var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService<AbpTickerQFunctionProvider>();\n        foreach (var jobConfiguration in abpBackgroundJobOptions.Value.GetJobs())\n        {\n            var genericMethod = GetTickerFunctionDelegateMethod.MakeGenericMethod(jobConfiguration.ArgsType);\n            var tickerFunctionDelegate = (TickerFunctionDelegate)genericMethod.Invoke(null, [jobConfiguration.ArgsType])!;\n            var config = abpBackgroundJobsTickerQOptions.Value.GetConfigurationOrNull(jobConfiguration.JobType);\n            abpTickerQFunctionProvider.AddFunction(jobConfiguration.JobName, tickerFunctionDelegate, config?.Priority ?? TickerTaskPriority.Normal, config?.MaxConcurrency ?? 0);\n            abpTickerQFunctionProvider.RequestTypes.TryAdd(jobConfiguration.JobName, (jobConfiguration.ArgsType.FullName, jobConfiguration.ArgsType)!);\n        }\n    }\n\n    private static TickerFunctionDelegate GetTickerFunctionDelegate<TArgs>(Type argsType)\n    {\n        return async (cancellationToken, serviceProvider, context) =>\n        {\n            var options = serviceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value;\n            if (!options.IsJobExecutionEnabled)\n            {\n                throw new AbpException(\n                    \"Background job execution is disabled. \" +\n                    \"This method should not be called! \" +\n                    \"If you want to enable the background job execution, \" +\n                    $\"set {nameof(AbpBackgroundJobOptions)}.{nameof(AbpBackgroundJobOptions.IsJobExecutionEnabled)} to true! \" +\n                    \"If you've intentionally disabled job execution and this seems a bug, please report it.\"\n                );\n            }\n\n            using (var scope = serviceProvider.CreateScope())\n            {\n                var jobExecuter = serviceProvider.GetRequiredService<IBackgroundJobExecuter>();\n                var args = await TickerRequestProvider.GetRequestAsync<TArgs>(context, cancellationToken);\n                var jobType = options.GetJob(typeof(TArgs)).JobType;\n                var jobExecutionContext = new JobExecutionContext(scope.ServiceProvider, jobType, args!, cancellationToken: cancellationToken);\n                await jobExecuter.ExecuteAsync(jobExecutionContext);\n            }\n        };\n    }","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs#L26-L62","documentation":"Thrown inside the TickerQ function delegate when a background job is dispatched for execution but AbpBackgroundJobOptions.IsJobExecutionEnabled is false. The TickerQ worker still receives the job (it's registered as a function) and, before executing, asserts that execution is enabled - if not, it throws AbpException. This protects against running job handlers in a host that intentionally disabled execution (e.g. a web node that only enqueues).","triggerScenarios":"AbpBackgroundJobOptions.IsJobExecutionEnabled == false (the default in some host configurations or explicitly set) while a TickerQ worker function is invoked for a registered job type.","commonSituations":"Deploying a worker host that forgot to set IsJobExecutionEnabled = true; sharing the job module across a web API host (execution disabled) and a worker host; misconfigured environment where the worker module is loaded but the option isn't enabled; leftover registration after disabling execution.","solutions":["Enable execution in the worker host: configure AbpBackgroundJobOptions.IsJobExecutionEnabled = true.","If this host should NOT run jobs, remove the TickerQ worker/job registration from it (or don't load the worker module here).","Verify the option is configured in the correct host/project (PreConfigureServices/ConfigureServices of the executing app).","Confirm you didn't disable execution globally while still loading the TickerQ module."],"exampleFix":"// before: jobs dispatched but IsJobExecutionEnabled defaults/sets to false -> AbpException\n// after\nConfigure<AbpBackgroundJobOptions>(options =>\n{\n    options.IsJobExecutionEnabled = true;\n});","handlingStrategy":"validation","validationCode":"var opts = serviceProvider.GetRequiredService<IOptions<AbpBackgroundJobOptions>>().Value;\nif (!opts.IsJobExecutionEnabled)\n{\n    // do not dispatch jobs in this host, or enable the option\n}","typeGuard":"null","tryCatchPattern":"try { /* job dispatch path */ }\ncatch (AbpException ex) when (ex.Message.Contains(\"Background job execution is disabled\"))\n{ /* enable IsJobExecutionEnabled or stop loading the worker module here */ }","preventionTips":["Set IsJobExecutionEnabled = true only in hosts meant to execute jobs.","Don't load the TickerQ worker module in hosts that only enqueue.","Centralize AbpBackgroundJobOptions config per host in a shared extension method.","Smoke-test job execution after deployment."],"tags":["background-jobs","tickerq","abp","configuration","worker"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}