{"record":{"id":"58152723bb17de3e","repo":"flowable/flowable-engine","slug":"could-not-find-a-job-with-id-jobid","errorCode":null,"errorMessage":"Could not find a job with id '${jobId}'.","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":229,"sourceCode":"    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the job was executed. Response-body is intentionally empty.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested job was not found.\"),\n            @ApiResponse(code = 500, message = \"Indicates the an exception occurred while executing the job. The status-description contains additional detail about the error. The full error-stacktrace can be fetched later on if needed.\")\n    })\n    @PostMapping(\"/cmmn-management/jobs/{jobId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void executeJobAction(@ApiParam(name = \"jobId\") @PathVariable String jobId, @RequestBody RestActionRequest actionRequest) {\n        if (actionRequest == null || !EXECUTE_ACTION.equals(actionRequest.getAction())) {\n            throw new FlowableIllegalArgumentException(\"Invalid action, only 'execute' is supported.\");\n        }\n        \n        Job job = getJobById(jobId);\n\n        try {\n            managementService.executeJob(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 = \"Execute a single job action (move or reschedule)\", tags = { \"Jobs\" }, code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the timer job action was executed. Response-body is intentionally empty.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested job was not found.\"),\n            @ApiResponse(code = 500, message = \"Indicates the an exception occurred while executing the job. The status-description contains additional detail about the error. The full error-stacktrace can be fetched later on if needed.\")\n    })\n    @PostMapping(\"/cmmn-management/timer-jobs/{jobId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void executeTimerJobAction(@ApiParam(name = \"jobId\") @PathVariable String jobId, @RequestBody TimerJobActionRequest actionRequest) {\n        if (actionRequest == null || !(MOVE_ACTION.equals(actionRequest.getAction()) || RESCHEDULE_ACTION.equals(actionRequest.getAction()))) {\n            throw new FlowableIllegalArgumentException(\"Invalid action, only 'move' or 'reschedule' are supported.\");\n        }\n        \n        Job job = getTimerJobById(jobId);\n","sourceCodeStart":211,"sourceCodeEnd":247,"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#L211-L247","documentation":"Thrown by POST /cmmn-management/jobs/{jobId} when the action is valid ('execute') but managementService.executeJob cannot find the job, so the REST layer re-throws FlowableObjectNotFoundException with the uniform message and Job.class type for a consistent 404.","triggerScenarios":"POST /cmmn-management/jobs/{jobId} (action=execute) where the job was already acquired and executed by the async executor between listing and the call, or the id is not a plain job id.","commonSituations":"Manually executing jobs while the async executor is also running (executor wins the race); id from timer/deadletter tables passed to the jobs endpoint; stale job list in an admin UI.","solutions":["Re-check the job exists with createJobQuery().jobId(jobId) and re-fetch fresh ids right before executing.","Handle 404 as 'already executed elsewhere' and continue rather than failing.","Pause the async executor during manual job administration, or check the job's lockOwner/lockExpiration to see if the executor owns it."],"exampleFix":"// before\nJob job = jobsFromOldList.get(0);\npost(\"/cmmn-management/jobs/\" + job.getId(), {\"action\":\"execute\"});\n// after\nJob job = managementService.createJobQuery().jobId(id).singleResult();\nif (job != null) {\n    post(\"/cmmn-management/jobs/\" + job.getId(), {\"action\":\"execute\"});\n}","handlingStrategy":"try-catch","validationCode":"Job j = managementService.createJobQuery().jobId(jobId).singleResult();\nboolean safe = j != null && j.getLockOwner() == null;","typeGuard":null,"tryCatchPattern":"try { managementService.executeJob(jobId); }\ncatch (FlowableObjectNotFoundException e) { /* executor already ran it — continue */ }","preventionTips":["Fetch job ids immediately before executing","Check lockOwner/lockExpiration to avoid racing the async executor","Treat 404 as 'already executed' in admin flows"],"tags":["flowable","rest-api","job-execution","not-found","race-condition"],"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"}