{"record":{"id":"5c139c38d04bbe3b","repo":"elunez/eladmin","slug":"error-5c139c","errorCode":null,"errorMessage":"定时任务暂停失败","messagePattern":"定时任务暂停失败","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzManage.java","lineNumber":174,"sourceCode":"            JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId());\n            scheduler.triggerJob(jobKey,dataMap);\n        } catch (Exception e){\n            log.error(\"定时任务执行失败\", e);\n            throw new BadRequestException(\"定时任务执行失败\");\n        }\n    }\n\n    /**\n     * 暂停一个job\n     * @param quartzJob /\n     */\n    public void pauseJob(QuartzJob quartzJob){\n        try {\n            JobKey jobKey = JobKey.jobKey(JOB_NAME + quartzJob.getId());\n            scheduler.pauseJob(jobKey);\n        } catch (Exception e){\n            log.error(\"定时任务暂停失败\", e);\n            throw new BadRequestException(\"定时任务暂停失败\");\n        }\n    }\n}\n","sourceCodeStart":156,"sourceCodeEnd":178,"githubUrl":"https://github.com/elunez/eladmin/blob/55fbf705956949697dbd68bf9003776609d3d029/eladmin-system/src/main/java/me/zhengjie/modules/quartz/utils/QuartzManage.java#L156-L178","documentation":"QuartzManage.pauseJob simply calls scheduler.pauseJob(jobKey); a SchedulerException is logged and rethrown as BadRequestException '定时任务暂停失败'. pauseJob is also invoked from addJob/updateJobCron when a job is saved in the paused state, so this error can surface during create/update of a paused job, not only from the pause endpoint.","triggerScenarios":"Pausing a job (updateIsPause endpoint) when the job key does not exist in the scheduler — pauseJob on a missing key throws — or when the scheduler/store is in an error state. Also triggered as part of addJob for jobs saved with isPause=true.","commonSituations":"Pausing a job whose scheduler entry was lost (RAM job store reset, partial deletes); clustered quartz with a failed node; scheduler in standby.","solutions":["Check the stack trace in the log for the exact SchedulerException.","If the job key is missing, resume flows (error 33) recreate it — or simply recreate the job.","Verify quartz store configuration and that the scheduler is running (scheduler.isStarted())."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// idempotent pause: only pause keys the scheduler knows\nJobKey jk = JobKey.jobKey(\"JOB_NAME\" + job.getId());\nif (scheduler.checkExists(jk)) scheduler.pauseJob(jk);\nelse quartzManage.addJob(job); // rebuild then pause","typeGuard":null,"tryCatchPattern":"try { quartzJobService.updateIsPause(job); } catch (BadRequestException e) { if (\"定时任务暂停失败\".equals(e.getMessage())) { log.error(\"pause failed\", e); return fail(\"暂停失败：任务调度状态异常，建议重建任务\"); } throw e; }","preventionTips":["Remember pauseJob also runs during create/update of paused jobs — scheduler health matters there too.","Validate scheduler started state in a startup health check.","Keep job stores consistent to avoid pausing nonexistent keys."],"tags":["quartz","scheduler","pause","state-mismatch"],"backgroundTag":null,"analyzedSha":"55fbf705956949697dbd68bf9003776609d3d029","analyzedAt":"2026-08-14T11:56:12.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}