{"record":{"id":"71b7d5c96f747669","repo":"flowable/flowable-engine","slug":"could-not-find-a-history-job-with-id","errorCode":null,"errorMessage":"Could not find a history job with id ''.","messagePattern":"Could not find a history job with id ''\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobBaseResource.java","lineNumber":76,"sourceCode":"    protected HistoryJob getHistoryJobById(String jobId) {\n        HistoryJob job = managementService.createHistoryJobQuery().jobId(jobId).singleResult();\n        validateHistoryJob(job, jobId);\n        return job;\n    }\n    \n    protected void validateJob(Job job, String jobId) {\n        if (job == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a job with id '\" + jobId + \"'.\", Job.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessJobInfoById(job);\n        }\n    }\n\n    protected void validateHistoryJob(HistoryJob job, String jobId) {\n        if (job == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a history job with id '\" + jobId + \"'.\", HistoryJob.class);\n        }\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessHistoryJobInfoById(job);\n        }\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":84,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobBaseResource.java#L58-L84","documentation":"validateHistoryJob throws FlowableObjectNotFoundException when no HistoryJob exists for the given id; getHistoryJobById uses it. Distinguishes history (permanent log) jobs from ordinary runtime jobs, which are validated by the sibling validateJob.","triggerScenarios":"GET /cmmn-management/history/jobs/{jobId} with an id that is not a history job — including ids of runtime/timer/dead-letter jobs or already-deleted history jobs.","commonSituations":"Using a runtime job id against the history endpoint; history cleanup already deleted the job; id from a different engine database.","solutions":["Confirm the id refers to a history job by querying /cmmn-management/history/jobs first.","If the job is a runtime job, use the matching runtime job endpoint.","Handle 404 as 'history job gone' (e.g. deleted by history cleanup)."],"exampleFix":"// before\nString stack = client.get(\"/cmmn-management/history/jobs/\" + runtimeJobId);\n// after\nString stack = client.get(\"/cmmn-management/history/jobs/\" + historyJobId);","handlingStrategy":"try-catch","validationCode":"const isHistoryJob = historyJobs.some(j => j.id === jobId);","typeGuard":null,"tryCatchPattern":"try { job = getHistoryJob(id) } catch (e) { if (e.status === 404) return null; throw e; }","preventionTips":["Use the history job list endpoint to obtain valid ids.","Remember history cleanup deletes history jobs — handle 404 gracefully.","Don't mix runtime and history job ids."],"tags":["rest-api","resource-not-found","jobs"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}