{"record":{"id":"d94773cf84efe00c","repo":"flowable/flowable-engine","slug":"could-not-find-a-job-with-id-d94773","errorCode":null,"errorMessage":"Could not find a job with id ''.","messagePattern":"Could not find a 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/JobResource.java","lineNumber":134,"sourceCode":"        }\n\n        return null;\n    }\n\n    @ApiOperation(value = \"Delete a job\", tags = { \"Jobs\" }, code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the job was found and has been deleted. Response-body is intentionally empty.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested job was not found..\")\n    })\n    @DeleteMapping(\"/cmmn-management/jobs/{jobId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void deleteJob(@ApiParam(name = \"jobId\") @PathVariable String jobId) {\n        Job job = getJobById(jobId);\n        try {\n            managementService.deleteJob(job.getId());\n        } catch (FlowableObjectNotFoundException e) {\n            // Re-throw to have consistent error-messaging across REST-api\n            throw new FlowableObjectNotFoundException(\"Could not find a job with id '\" + jobId + \"'.\", Job.class);\n        }\n    }\n\n    @ApiOperation(value = \"Delete a timer job\", tags = { \"Jobs\" }, code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the job was found and has been deleted. Response-body is intentionally empty.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested job was not found.\")\n    })\n    @DeleteMapping(\"/cmmn-management/timer-jobs/{jobId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void deleteTimerJob(@ApiParam(name = \"jobId\") @PathVariable String jobId) {\n        Job job = getTimerJobById(jobId);\n        try {\n            managementService.deleteTimerJob(job.getId());\n        } catch (FlowableObjectNotFoundException e) {\n            // Re-throw to have consistent error-messaging across REST-api\n            throw new FlowableObjectNotFoundException(\"Could not find a job with id '\" + jobId + \"'.\", Job.class);\n        }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/management/JobResource.java#L116-L152","documentation":"Thrown by DELETE /cmmn-management/jobs/{jobId} when the job disappears between the lookup and the deletion, or managementService.deleteJob cannot find it; the original exception is re-thrown with a standardized REST message. It guarantees consistent 404 semantics across the CMMN REST API.","triggerScenarios":"DELETE /cmmn-management/jobs/{jobId} for a jobId that does not exist (or was deleted by a concurrent worker / the engine between fetch and delete).","commonSituations":"Job already completed and swept by the async executor; duplicate DELETE calls (double-click / retried request); stale job ids from an old list response; typo'd id.","solutions":["Confirm the job exists: managementService.createJobQuery().jobId(jobId).singleResult() before deleting.","Handle the 404 as idempotent success if the goal is just to get rid of the job.","Re-fetch the job list to get fresh ids; avoid deleting from stale snapshots."],"exampleFix":"// before\nJob job = getJobById(jobId);\nmanagementService.deleteJob(job.getId());\n// after\nJob job = managementService.createJobQuery().jobId(jobId).singleResult();\nif (job != null) {\n    managementService.deleteJob(job.getId());\n}","handlingStrategy":"try-catch","validationCode":"Job j = managementService.createJobQuery().jobId(jobId).singleResult();","typeGuard":null,"tryCatchPattern":"try { managementService.deleteJob(jobId); }\ncatch (FlowableObjectNotFoundException e) { /* already gone — idempotent success */ }","preventionTips":["Make deletes idempotent (404 == success)","Use fresh job lists, not stale snapshots","Beware the async executor sweeping jobs concurrently"],"tags":["flowable","rest-api","job","delete","not-found"],"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-14T05:17:10.506Z"}