{"record":{"id":"990985b720daf89c","repo":"flowable/flowable-engine","slug":"errorhandlerid-not-found-in-process-definition","errorCode":null,"errorMessage":"${errorHandlerId} not found in process definition","messagePattern":"(.+?) not found in process definition","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ErrorPropagation.java","lineNumber":125,"sourceCode":"            }\n        }\n        return null;\n    }\n\n    private static ActivityExecution getSuperExecution(ActivityExecution execution) {\n        ExecutionEntity executionEntity = (ExecutionEntity) execution;\n        ExecutionEntity superExecution = executionEntity.getProcessInstance().getSuperExecution();\n        if (superExecution != null && !superExecution.isScope()) {\n            return superExecution.getParent();\n        }\n        return superExecution;\n    }\n\n    private static void executeCatch(String errorHandlerId, ActivityExecution execution, String errorCode) {\n        ProcessDefinitionImpl processDefinition = ((ExecutionEntity) execution).getProcessDefinition();\n        ActivityImpl errorHandler = processDefinition.findActivity(errorHandlerId);\n        if (errorHandler == null) {\n            throw new ActivitiException(errorHandlerId + \" not found in process definition\");\n        }\n\n        boolean matchingParentFound = false;\n        ActivityExecution leavingExecution = execution;\n        ActivityImpl currentActivity = (ActivityImpl) execution.getActivity();\n\n        ScopeImpl catchingScope = errorHandler.getParent();\n        if (catchingScope instanceof ActivityImpl) {\n            ActivityImpl catchingScopeActivity = (ActivityImpl) catchingScope;\n            if (!catchingScopeActivity.isScope()) { // event subprocesses\n                catchingScope = catchingScopeActivity.getParent();\n            }\n        }\n\n        if (catchingScope instanceof PvmProcessDefinition) {\n            executeEventHandler(errorHandler, ((ExecutionEntity) execution).getProcessInstance(), errorCode);\n\n        } else {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ErrorPropagation.java#L107-L143","documentation":"After an error event handler (boundary/event-subprocess activity) is found by id, executeCatch looks it up in the process definition. If the referenced activity id does not exist in the deployed process definition, it throws ActivitiException.","triggerScenarios":"An internal handler id (error event handler resolved by findLocalErrorEventHandler) is not present in the process definition returned for the current execution — typically an inconsistent or outdated process definition/execution pairing.","commonSituations":"Process definition redeployed/changed while old executions are running; custom code calling executeCatch paths with a hand-built id; corrupted or mismatched deployment data.","solutions":["Redeploy a consistent process definition and restart/complete affected process instances","Verify the errorHandlerId corresponds to an existing activity id in the deployed BPMN XML","Migrate or terminate old process instances that reference stale definitions","Check deployment/definition cache consistency (same process definition version for execution)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    completeTask(taskId);\n} catch (org.activiti.engine.ActivitiException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not found in process definition\")) {\n        logger.error(\"Stale process definition for running execution\", e);\n    }\n    throw e;\n}","preventionTips":["Keep deployments atomic: change definitions and their callers together","Terminate or migrate old instances before removing activities","Avoid relying on internal executeCatch APIs with hand-built ids"],"tags":["bpmn","process-definition","internal"],"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-18T11:17:12.947Z"}