{"record":{"id":"67916fbeefa3174e","repo":"quarkusio/quarkus","slug":"quartz-scheduler-is-either-explicitly-disabled-thr","errorCode":null,"errorMessage":"Quartz scheduler is either explicitly disabled through quarkus.scheduler.enabled=false or no @Scheduled methods were found. If you only need to schedule a job programmatically you can force the start of the scheduler by setting 'quarkus.scheduler.start-mode=forced'.","messagePattern":"Quartz scheduler is either explicitly disabled through quarkus\\.scheduler\\.enabled=false or no @Scheduled methods were found\\. If you only need to schedule a job programmatically you can force the start of the scheduler by setting 'quarkus\\.scheduler\\.start-mode=forced'\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java","lineNumber":324,"sourceCode":"                }\n            } catch (Throwable e) {\n                if (transaction != null) {\n                    try {\n                        transaction.rollback();\n                    } catch (SystemException ex) {\n                        LOGGER.error(\"Unable to rollback transaction\", ex);\n                    }\n                }\n                throw new IllegalStateException(\"Unable to create Scheduler\", e);\n            }\n        }\n    }\n\n    @Produces\n    @Singleton\n    org.quartz.Scheduler produceQuartzScheduler() {\n        if (scheduler == null) {\n            throw new IllegalStateException(\n                    \"Quartz scheduler is either explicitly disabled through quarkus.scheduler.enabled=false or no @Scheduled methods were found. If you only need to schedule a job programmatically you can force the start of the scheduler by setting 'quarkus.scheduler.start-mode=forced'.\");\n        }\n        return scheduler;\n    }\n\n    @Override\n    public org.quartz.Scheduler getScheduler() {\n        return scheduler;\n    }\n\n    @Override\n    public boolean isStarted() {\n        return scheduler != null;\n    }\n\n    @Override\n    public String implementation() {\n        return Scheduled.QUARTZ;","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java#L306-L342","documentation":"produceQuartzScheduler is a CDI @Produces method for org.quartz.Scheduler. If the scheduler was never started — because quarkus.scheduler.enabled=false or the application contains no @Scheduled methods — the producer throws IllegalStateException explaining the situation and suggesting quarkus.scheduler.start-mode=forced.","triggerScenarios":"Inject org.quartz.Scheduler (or get it via CDI) when the scheduler is disabled via quarkus.scheduler.enabled=false, or when no @Scheduled methods exist so the lazy scheduler was never created and start-mode is not 'forced'.","commonSituations":"Injecting the Scheduler to schedule jobs programmatically in an app with no annotated @Scheduled methods; QA/test config disabling the scheduler; app assembled from reusable modules without scheduled methods.","solutions":["Set quarkus.scheduler.start-mode=forced to start the scheduler even without @Scheduled methods.","Remove quarkus.scheduler.enabled=false (or set it to true) if you actually want the scheduler.","Ensure at least one @Scheduled method exists, or schedule programmatically only after forcing startup.","Guard injection so the Scheduler is only requested when it's expected to be running."],"exampleFix":"# before\nquarkus.scheduler.enabled=false\n// injecting org.quartz.Scheduler fails\n\n# after\nquarkus.scheduler.start-mode=forced","handlingStrategy":"validation","validationCode":"boolean enabled = ConfigProvider.getConfig().getOptionalValue(\"quarkus.scheduler.enabled\", Boolean.class).orElse(true);\nString startMode = ConfigProvider.getConfig().getOptionalValue(\"quarkus.scheduler.start-mode\", String.class).orElse(\"normal\");\nboolean hasScheduledMethods = /* true if app declares @Scheduled */ false;\nif (!enabled || (!hasScheduledMethods && !\"forced\".equals(startMode))) {\n    log.warn(\"Scheduler not started; org.quartz.Scheduler injection will fail\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Scheduler s = CDI.current().select(org.quartz.Scheduler.class).get();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"quarkus.scheduler.enabled=false\")) {\n        // scheduler intentionally off: fall back to a no-op scheduling path\n        return;\n    }\n    throw e;\n}","preventionTips":["Set quarkus.scheduler.start-mode=forced whenever you schedule jobs only programmatically.","Avoid disabling the scheduler in profiles where the Scheduler bean is injected.","Track @Scheduled usage in reusable modules to anticipate lazy-scheduler behavior."],"tags":["quarkus","quartz","cdi","scheduler","configuration"],"backgroundTag":"scheduler-disabled-or-lazy-not-started","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}