{"record":{"id":"98e59443f2a9a94c","repo":"apache/dolphinscheduler","slug":"quartz-upsert-job-error","errorCode":"QUARTZ_UPSERT_JOB_ERROR","errorMessage":"QUARTZ_UPSERT_JOB_ERROR","messagePattern":"QUARTZ_UPSERT_JOB_ERROR","errorType":"error_code","errorClass":"SchedulerException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java","lineNumber":67,"sourceCode":"        }\n    }\n\n    @Override\n    public void insertOrUpdateScheduleTask(int projectId, Schedule schedule) throws SchedulerException {\n        try {\n            CronTrigger cornTrigger = QuartzCornTriggerBuilder.newBuilder()\n                    .withProjectId(projectId)\n                    .withSchedule(schedule)\n                    .build();\n            JobDetail jobDetail = QuartzJobDetailBuilder.newBuilder()\n                    .withProjectId(projectId)\n                    .withSchedule(schedule.getId())\n                    .build();\n            scheduler.scheduleJob(jobDetail, Sets.newHashSet(cornTrigger), true);\n            log.info(\"Success scheduleJob: {} with trigger: {} at quartz\", jobDetail, cornTrigger);\n        } catch (Exception e) {\n            log.error(\"Failed to add scheduler task, projectId: {}, scheduler: {}\", projectId, schedule, e);\n            throw new SchedulerException(QuartzSchedulerExceptionEnum.QUARTZ_UPSERT_JOB_ERROR, e);\n        }\n    }\n\n    @Override\n    public void deleteScheduleTask(int projectId, int scheduleId) throws SchedulerException {\n        JobKey jobKey = QuartzJobKey.of(projectId, scheduleId).toJobKey();\n        try {\n            if (scheduler.checkExists(jobKey)) {\n                log.info(\"Try to delete scheduler task, projectId: {}, schedulerId: {}\", projectId, scheduleId);\n                scheduler.deleteJob(jobKey);\n            }\n        } catch (Exception e) {\n            log.error(\"Failed to delete scheduler task, projectId: {}, schedulerId: {}\", projectId, scheduleId, e);\n            throw new SchedulerException(QuartzSchedulerExceptionEnum.QUARTZ_DELETE_JOB_ERROR, e);\n        }\n    }\n\n    @Override","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java#L49-L85","documentation":"Quartz rejected scheduleJob while creating or replacing the job/trigger for a workflow schedule — common causes are an invalid cron expression the Quartz parser refuses, a JobDataMap losing serializability, or a store concurrency conflict. The failed upsert leaves the old Quartz job in place, so the in-DB schedule state and Quartz state may diverge.","triggerScenarios":"Thrown at dolphinscheduler-scheduler-plugin/dolphinscheduler-scheduler-quartz/src/main/java/org/apache/dolphinscheduler/scheduler/quartz/QuartzScheduler.java:67 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the cron expression with CronUtils before the schedule reaches Quartz","Confirm the Quartz tables and datasource are healthy and not locked by another node","Check that the schedule record (projectId/scheduleId) is not concurrently modified by another master; retry the insertOrUpdate","Inspect the caused-by SchedulerException for the exact Quartz objection (DuplicateKey, class-not-found, serialization)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}