quarkusio/quarkus · error · IllegalStateException
A job with this identity is already scheduled: ${identity}
Error message
A job with this identity is already scheduled: ${identity} What it means
Quarkus throws this IllegalStateException from Scheduler.newJob(identity) when a job (programmatic scheduled task) with the given identity is already registered in the scheduler's task map. Identities must be unique; this guard prevents silently overwriting an existing QuartzJobDefinition.
Source
Thrown at extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzSchedulerImpl.java:491
public Trigger getScheduledJob(String identity) {
if (!isStarted()) {
throw notStarted();
}
Objects.requireNonNull(identity);
if (identity.isEmpty()) {
return null;
}
return scheduledTasks.get(SchedulerUtils.lookUpPropertyValue(identity));
}
@Override
public QuartzJobDefinition newJob(String identity) {
if (!isStarted()) {
throw notStarted();
}
Objects.requireNonNull(identity);
if (scheduledTasks.containsKey(identity)) {
throw new IllegalStateException("A job with this identity is already scheduled: " + identity);
}
return new QuartzJobDefinitionImpl(identity);
}
@Override
public Trigger unscheduleJob(String identity) {
if (!isStarted()) {
throw notStarted();
}
Objects.requireNonNull(identity);
if (!identity.isEmpty()) {
String parsedIdentity = SchedulerUtils.lookUpPropertyValue(identity);
QuartzTrigger trigger = scheduledTasks.get(parsedIdentity);
if (trigger != null && trigger.isProgrammatic) {
if (scheduledTasks.remove(identity) != null) {
try {
scheduler.unscheduleJob(trigger.triggerKey);
} catch (SchedulerException e) {View on GitHub (pinned to e1c734241f)
Solutions
- Pick a unique identity per job instance (e.g. append a UUID or business key)
- Check Scheduler.getScheduledJob(identity) for null before calling newJob()
- Call Scheduler.unscheduleJob(identity) to remove the existing programmatic job first
- Avoid reusing identities of static @Scheduled methods
Example fix
// before
scheduler.newJob("report"); // IllegalStateException on retry
// after
if (scheduler.getScheduledJob("report") == null) {
scheduler.newJob("report");
} else {
scheduler.unscheduleJob("report");
scheduler.newJob("report");
} Defensive patterns
Strategy: validation
Validate before calling
if (scheduler.getScheduledJob(identity) != null) {
throw new IllegalArgumentException("identity already used: " + identity);
} Try / catch
try {
scheduler.newJob(identity);
} catch (IllegalStateException e) {
// identity taken — regenerate or unschedule first
scheduler.unscheduleJob(identity);
scheduler.newJob(identity + "-" + UUID.randomUUID());
} Prevention
- Generate identities with a unique suffix (UUID, tenant id, timestamp)
- Never reuse identities of @Scheduled-annotated methods
- Check getScheduledJob(identity) == null before newJob()
When it happens
Trigger: Calling Scheduler.newJob("myJob") twice with the same identity without unscheduling the first; identity collides with a statically declared @Scheduled job's identity; a previous programmatic job was never removed via unscheduleJob().
Common situations: Generating job identities without uniqueness (missing UUID/tenant suffix); re-registering on reconnect/redeploy logic; same identity reused across application restarts when tasks are kept in the JDBC store.
Related errors
- Quartz scheduler is either explicitly disabled through quark
- Unable to pause scheduler
- Unable to pause job
- Unable to resume scheduler
- Unable to resume job
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c1c77dd7c51bb4dd.
Report an issue: GitHub.