{"record":{"id":"bc1d742c3578d306","repo":"flowable/flowable-engine","slug":"error-while-propagating-error-event-for-execut","errorCode":null,"errorMessage":"Error while propagating error-event for \" + execution","messagePattern":"Error while propagating error-event for \" \\+ execution","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java","lineNumber":64,"sourceCode":"                compatibilityHandler.throwErrorEvent(event);\n                return;\n            }\n\n            ExecutionEntity execution = null;\n\n            if (engineEvent.getExecutionId() != null) {\n                // Get the execution based on the event's execution ID instead\n                execution = CommandContextUtil.getExecutionEntityManager().findById(engineEvent.getExecutionId());\n            }\n\n            if (execution == null) {\n                throw new FlowableException(\"No execution context active and event (\" + event + \") is not related to an execution. No compensation event can be thrown.\");\n            }\n\n            try {\n                ErrorPropagation.propagateError(errorCode, execution);\n            } catch (Exception e) {\n                throw new FlowableException(\"Error while propagating error-event for \" + execution, e);\n            }\n        }\n    }\n\n    public void setErrorCode(String errorCode) {\n        this.errorCode = errorCode;\n    }\n\n    @Override\n    public boolean isFailOnException() {\n        return true;\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java#L46-L78","documentation":"This FlowableException wraps any exception thrown by ErrorPropagation.propagateError(errorCode, execution). It means the error event was resolved to an execution, but the actual propagation — finding a matching error boundary/catch handler in the BPMN model — failed while walking/acting on the model, e.g. due to a model inconsistency or an exception in handler lookup.","triggerScenarios":"ErrorThrowingEventListener.onEvent calls ErrorPropagation.propagateError and that method throws (e.g. BpmnModel inconsistency, no error handler found where the propagation logic assumes one, or a downstream FlowableException during catch-event handling).","commonSituations":"BPMN XML with an error event definition whose referenced error is missing/malformed; boundary events on subprocesses with mismatched error refs; custom ErrorThrowingEventListener wired via flowable:event-listener without a matching catch; bugs after engine version upgrades in error-handling code paths.","solutions":["Inspect the wrapped cause (e.getCause()) — the real failure is inside ErrorPropagation, not the listener.","Validate the BPMN model: ensure every errorEventDefinition's errorRef matches a declared <error> element and boundary/subprocess error handlers are correctly attached.","Confirm the errorCode set on the listener matches an existing error boundary event / error start event subscription.","Simplify: throw the BPMN error from a service task's delegateExecution or via runtimeService instead of a global listener, which gives clearer propagation semantics.","If it persists with a valid model, check the Flowable version for known error-propagation bugs and upgrade."],"exampleFix":"// before\nthrow new FlowableException(\"Error while propagating error-event for \" + execution, e); // cause ignored at call site\n\n// after\ncatch (Exception e) {\n    logger.error(\"error propagation failed for execution {}\", execution.getId(), e.getCause());\n    throw new FlowableException(\"Error while propagating error-event for \" + execution, e);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    errorThrowingEventListener.onEvent(engineEvent);\n} catch (FlowableException e) {\n    logger.error(\"error propagation failed\", e.getCause() != null ? e.getCause() : e);\n    // fall back: mark execution/compensation as pending for manual handling\n}","preventionTips":["Always log the root cause (getCause()) when wrapping exceptions.","Validate the BPMN model (errorRefs, boundary events) at deploy time.","Keep errorCode values consistent between throwers and catchers."],"tags":["flowable","bpmn","error-propagation","wrapped-exception"],"backgroundTag":"internal-invariant-violation","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"}