{"record":{"id":"84e54ba210a80714","repo":"flowable/flowable-engine","slug":"no-suspended-job-found-with-id","errorCode":null,"errorMessage":"No suspended job found with id '","messagePattern":"No suspended job found with id '","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteSuspendedJobCmd.java","lineNumber":76,"sourceCode":"    protected void sendCancelEvent(SuspendedJobEntity jobToDelete) {\n        FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();\n        if (eventDispatcher != null && eventDispatcher.isEnabled()) {\n            eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, jobToDelete),\n                    jobServiceConfiguration.getEngineName());\n        }\n    }\n\n    protected SuspendedJobEntity getJobToDelete(CommandContext commandContext) {\n        if (suspendedJobId == null) {\n            throw new FlowableIllegalArgumentException(\"jobId is null\");\n        }\n        if (LOGGER.isDebugEnabled()) {\n            LOGGER.debug(\"Deleting job {}\", suspendedJobId);\n        }\n\n        SuspendedJobEntity job = jobServiceConfiguration.getSuspendedJobEntityManager().findById(suspendedJobId);\n        if (job == null) {\n            throw new FlowableObjectNotFoundException(\"No suspended job found with id '\" + suspendedJobId + \"'\", Job.class);\n        }\n\n        return job;\n    }\n\n}\n","sourceCodeStart":58,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteSuspendedJobCmd.java#L58-L83","documentation":"DeleteSuspendedJobCmd fetches the job via SuspendedJobEntityManager.findById and throws FlowableObjectNotFoundException(\"No suspended job found with id '...'\") with Job.class when no suspended job row matches. The id is not present in the ACT_RU_SUSPENDED_JOB table.","triggerScenarios":"Deleting a suspended job after its process definition was activated again (the job moved back to the regular job table); deleting with a regular/dead-letter job id; double deletion; typo'd id.","commonSituations":"Suspend/activate cycles around job cleanup: code snapshots suspended job ids, the definition is activated, then cleanup runs against stale ids; tests that suspend, delete, activate, then delete again; id confusion between job tables.","solutions":["Re-query the suspended job table immediately before deletion and delete the current ids, not a stale snapshot.","If the definition was activated, the job now lives in the regular job table — use a job query and DeleteJobCmd instead.","Catch FlowableObjectNotFoundException for idempotent cleanup that may run concurrently with activation.","Confirm the id's job kind and engine/database before deleting."],"exampleFix":"// before\nmanagementService.executeCommand(new DeleteSuspendedJobCmd(staleId));\n// after\nif (managementService.createSuspendedJobQuery().suspendedJobId(staleId).count() > 0) {\n    managementService.executeCommand(new DeleteSuspendedJobCmd(staleId));\n} else if (managementService.createJobQuery().jobId(staleId).count() > 0) {\n    managementService.deleteJob(staleId); // job moved back after activation\n}","handlingStrategy":"validation","validationCode":"long count = managementService.createSuspendedJobQuery().suspendedJobId(suspendedJobId).count();\nif (count == 0) {\n    LOGGER.info(\"Suspended job {} not found; check activation state\", suspendedJobId);\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    managementService.executeCommand(new DeleteSuspendedJobCmd(suspendedJobId));\n} catch (FlowableObjectNotFoundException e) {\n    LOGGER.info(\"Suspended job {} no longer suspended\", suspendedJobId);\n}","preventionTips":["Re-query suspended jobs right before deletion instead of using stale id lists.","After activating a definition, switch cleanup to the regular job table.","Make suspend/activate + delete workflows idempotent."],"tags":["flowable","suspended-job","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-18T11:17:12.947Z"}