{"record":{"id":"7fef7f041dc44a3a","repo":"flowable/flowable-engine","slug":"no-external-worker-job-found-for-id-externaljob","errorCode":null,"errorMessage":"No External Worker job found for id: ${externalJobId}","messagePattern":"No External Worker job found for id: (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java","lineNumber":87,"sourceCode":"                .deleteIdentityLinksByScopeIdAndType(externalWorkerJob.getCorrelationId(), ScopeTypes.EXTERNAL_WORKER);\n    }\n\n    protected ExternalWorkerJobEntity resolveJob(CommandContext commandContext) {\n        if (StringUtils.isEmpty(externalJobId)) {\n            throw new FlowableIllegalArgumentException(\"externalJobId must not be empty\");\n        }\n\n        if (StringUtils.isEmpty(workerId)) {\n            throw new FlowableIllegalArgumentException(\"workerId must not be empty\");\n        }\n\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        ExternalWorkerJobEntityManager externalWorkerJobEntityManager = cmmnEngineConfiguration.getJobServiceConfiguration().getExternalWorkerJobEntityManager();\n\n        ExternalWorkerJobEntity job = externalWorkerJobEntityManager.findById(externalJobId);\n\n        if (job == null) {\n            throw new FlowableObjectNotFoundException(\"No External Worker job found for id: \" + externalJobId, ExternalWorkerJobEntity.class);\n        }\n\n        if (!Objects.equals(workerId, job.getLockOwner())) {\n            throw new FlowableIllegalArgumentException(workerId + \" does not hold a lock on the requested job\");\n        }\n\n        return job;\n    }\n}\n","sourceCodeStart":69,"sourceCodeEnd":97,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AbstractExternalWorkerJobCmd.java#L69-L97","documentation":"This FlowableObjectNotFoundException is thrown by AbstractExternalWorkerJobCmd.resolveJob when the external worker job entity manager cannot find an ExternalWorkerJobEntity with the given id. It means the engine has no persisted external worker job matching externalJobId, typically because it was already completed/deleted or the id is wrong. The lookup happens via CmmnEngineConfiguration's jobServiceConfiguration ExternalWorkerJobEntityManager.findById.","triggerScenarios":"Calling an external worker command (acquire, complete, terminate, bpmn/cmmn external worker job commands) with an externalJobId that does not exist in ACT_RU_EXT_JOB / the CMMN runtime job tables; job already acquired and completed by another worker then terminated; job deleted by cascading case deletion before this command runs.","commonSituations":"Worker retries with a stale job id after the job completed; multiple workers racing on the same job; passing a task/plan-item id instead of the external job id; case instance removed between job fetch and command execution; wrong engine datasource pointing at a different database.","solutions":["Verify the externalJobId comes from the job payload returned by the acquire-jobs REST/Java API, not from a task or plan item id","Re-fetch the job id immediately before the complete/terminate call and handle the not-found case as 'job already processed'","Check for multiple workers competing for the same job; rely on lockOwner/lockExpirationTime instead of reusing old ids","Confirm the app connects to the database where the job actually exists (correct datasource/engine configuration)","Check case history/audit tables to see whether the case instance (and thus the job) was deleted"],"exampleFix":"// before\nexternalWorkerJobCompletionCmd = new ExternalWorkerJobCompleteCmd<>(externalJobId, workerId, variables);\nmanagementService.executeCommand(externalWorkerJobCompletionCmd);\n// after\nExternalWorkerJob job = cmmnTaskService.getExternalWorkerJob(externalJobId); // or query first\nif (job != null && workerId.equals(job.getLockOwner())) {\n    managementService.executeCommand(new ExternalWorkerJobCompleteCmd<>(externalJobId, workerId, variables));\n} else {\n    logger.info(\"External worker job {} no longer exists; skipping\", externalJobId);\n}","handlingStrategy":"validation","validationCode":"ExternalWorkerJob job = cmmnTaskService.createExternalWorkerJobQueryBuilder().externalWorkerJobId(externalJobId).singleResult();\nif (job == null) throw new IllegalStateException(\"External worker job \" + externalJobId + \" does not exist\");","typeGuard":null,"tryCatchPattern":"try { managementService.executeCommand(new ExternalWorkerJobCompleteCmd<>(jobId, workerId, vars)); }\ncatch (FlowableObjectNotFoundException e) { log.info(\"Job {} already processed/removed\", jobId); }","preventionTips":["Always source externalJobId from the acquire-jobs response","Treat not-found as an idempotent 'already done' outcome in workers","Avoid persisting job ids across lock expiration windows","Verify datasource configuration points at the engine database holding the jobs"],"tags":["flowable","cmmn","entity-not-found","external-worker-job"],"backgroundTag":"entity-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"}