{"record":{"id":"8695e29a5ed29abc","repo":"flowable/flowable-engine","slug":"no-external-worker-job-found-with-id","errorCode":null,"errorMessage":"No external worker job found with id '","messagePattern":"No external worker 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/DeleteExternalWorkerJobCmd.java","lineNumber":50,"sourceCode":"    protected String jobId;\n    protected JobServiceConfiguration jobServiceConfiguration;\n\n    public DeleteExternalWorkerJobCmd(String jobId, JobServiceConfiguration jobServiceConfiguration) {\n        this.jobId = jobId;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (jobId == null) {\n            throw new FlowableIllegalArgumentException(\"jobId is null\");\n        }\n\n        ExternalWorkerJobEntityManager jobEntityManager = jobServiceConfiguration.getExternalWorkerJobEntityManager();\n\n        ExternalWorkerJobEntity job = jobEntityManager.findById(jobId);\n        if (job == null) {\n            throw new FlowableObjectNotFoundException(\"No external worker job found with id '\" + jobId + \"'\", Job.class);\n        }\n\n        FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();\n        if (eventDispatcher != null && eventDispatcher.isEnabled()) {\n            eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, job),\n                    jobServiceConfiguration.getEngineName());\n        }\n\n        jobEntityManager.delete(job);\n\n        return null;\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/DeleteExternalWorkerJobCmd.java#L32-L64","documentation":"DeleteExternalWorkerJobCmd loads the external worker job via ExternalWorkerJobEntityManager.findById and throws FlowableObjectNotFoundException when no entity matches the given id. The referenced row does not exist in the external worker job table at deletion time.","triggerScenarios":"Deleting an external worker job whose id was already consumed (e.g. after acquireAndLock/complete/bpmnError removed it), an id belonging to another job type (regular timer/message job instead of external worker job), or a fabricated/typo id.","commonSituations":"External worker job completed concurrently by another worker or lock expired and the job was recycled; cancel paths in tests running twice; querying ACT_RU_EXT_JOB ids through the wrong management API; multi-engine setups where the id exists in a different engine's database.","solutions":["Look up the job first via the external worker job query (managementService.getExternalWorkerJobs or ExternalWorkerJobQueryBuilder) and only delete when found.","Treat FlowableObjectNotFoundException as success (idempotent delete) in code that runs cancellation concurrently.","Confirm the id is an external worker job id, not a timer/message/suspended job id — different tables hold different job kinds.","Verify both the worker and the engine point at the same database/schema and tenant."],"exampleFix":"// before\nmanagementService.executeCommand(new DeleteExternalWorkerJobCmd(externalJobId));\n// after\nif (managementService.createExternalWorkerJobQueryBuilder().externalWorkerJobId(externalJobId).count() > 0) {\n    managementService.executeCommand(new DeleteExternalWorkerJobCmd(externalJobId));\n}","handlingStrategy":"try-catch","validationCode":"long count = managementService.createExternalWorkerJobQueryBuilder()\n        .externalWorkerJobId(externalJobId).count();\nif (count == 0) { LOGGER.info(\"External worker job {} not found; skipping\", externalJobId); return; }","typeGuard":null,"tryCatchPattern":"try {\n    managementService.executeCommand(new DeleteExternalWorkerJobCmd(externalJobId));\n} catch (FlowableObjectNotFoundException e) {\n    LOGGER.info(\"External worker job {} already removed\", externalJobId);\n}","preventionTips":["Account for concurrent workers completing/acquiring the same job.","Verify the id is an external worker job id, not another job kind.","Use idempotent delete logic in cancellation paths."],"tags":["flowable","external-worker","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"}