{"record":{"id":"69d67137cb163c3d","repo":"quarkusio/quarkus","slug":"unable-to-unschedule-job-with-identity-identity","errorCode":null,"errorMessage":"Unable to unschedule job with identity: ${identity}","messagePattern":"Unable to unschedule job with identity: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java","lineNumber":510,"sourceCode":"        }\n        return new QuartzJobDefinitionImpl(identity);\n    }\n\n    @Override\n    public Trigger unscheduleJob(String identity) {\n        if (!isStarted()) {\n            throw notStarted();\n        }\n        Objects.requireNonNull(identity);\n        if (!identity.isEmpty()) {\n            String parsedIdentity = SchedulerUtils.lookUpPropertyValue(identity);\n            QuartzTrigger trigger = scheduledTasks.get(parsedIdentity);\n            if (trigger != null && trigger.isProgrammatic) {\n                if (scheduledTasks.remove(identity) != null) {\n                    try {\n                        scheduler.unscheduleJob(trigger.triggerKey);\n                    } catch (SchedulerException e) {\n                        throw new IllegalStateException(\"Unable to unschedule job with identity: \" + identity);\n                    }\n                    return trigger;\n                }\n            }\n        }\n        return null;\n    }\n\n    // Use Interceptor.Priority.PLATFORM_BEFORE to start the scheduler before regular StartupEvent observers\n    void start(@Observes @Priority(Interceptor.Priority.PLATFORM_BEFORE) StartupEvent startupEvent) {\n        if (scheduler == null || startHalted) {\n            return;\n        }\n        try {\n            scheduler.start();\n        } catch (SchedulerException e) {\n            throw new IllegalStateException(\"Unable to start Scheduler\", e);\n        }","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java#L492-L528","documentation":"Quarkus throws this IllegalStateException from Scheduler.unscheduleJob(identity) when the underlying Quartz scheduler.unscheduleJob(triggerKey) fails with a SchedulerException. Note the original cause is dropped (not chained). Only programmatic jobs (created via newJob()) can be unscheduled this way; static @Scheduled jobs return null.","triggerScenarios":"Calling Scheduler.unscheduleJob(identity) for an existing programmatic job whose trigger cannot be removed — e.g. JDBC JobStore DB failure, clustered store lock contention, or the trigger no longer existing in the store.","commonSituations":"Database-backed store unreachable; job's trigger was removed externally (another node, manual DB edit); calling for a static @Scheduled job identity silently returns null instead; race with concurrent unscheduleJob calls.","solutions":["Verify datasource connectivity when using the jdbc store","Confirm the job is programmatic (unscheduleJob returns null for @Scheduled-annotated jobs)","Check whether the trigger was already removed (idempotent handling of the identity)","Retry the unschedule; the removed entry is already dropped from the in-memory map so state may need reconciliation"],"exampleFix":"// before\nTrigger t = scheduler.unscheduleJob(\"myJob\");\n// after\nTrigger t = scheduler.getScheduledJob(\"myJob\");\nif (t != null) {\n    try {\n        scheduler.unscheduleJob(\"myJob\");\n    } catch (IllegalStateException e) {\n        LOGGER.warnf(\"Unschedule failed for myJob: %s\", e.getMessage());\n    }\n}","handlingStrategy":"validation","validationCode":"Trigger t = scheduler.getScheduledJob(identity);\nif (t == null) return; // nothing to unschedule","typeGuard":null,"tryCatchPattern":"try {\n    scheduler.unscheduleJob(identity);\n} catch (IllegalStateException e) {\n    LOGGER.warnf(\"Unschedule failed for %s; trigger may already be gone\", identity);\n}","preventionTips":["Only call for programmatic jobs (static @Scheduled jobs return null)","Handle the exception as the cause is not chained — log identity for tracing","Make unscheduling idempotent; concurrent callers may race"],"tags":["quartz","scheduler","unschedule","jobstore"],"backgroundTag":"job-unschedule-failed","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"}