flowable/flowable-engine · error · FlowableException
No execution context active and event (" + event + ") is not
Error message
No execution context active and event (" + event + ") is not related to an execution. No compensation event can be thrown. What it means
ErrorThrowingEventListener.onEvent throws this FlowableException when it needs to propagate a BPMN error (compensation) but cannot resolve any Execution to act on: neither the event's executionId resolved to an existing execution nor was a default execution available. Error propagation (ErrorPropagation.propagateError) requires an execution context, so the listener aborts.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/ErrorThrowingEventListener.java:58
CommandContext commandContext = Context.getCommandContext();
if (engineEvent.getProcessDefinitionId() != null &&
Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, engineEvent.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
compatibilityHandler.throwErrorEvent(event);
return;
}
ExecutionEntity execution = null;
if (engineEvent.getExecutionId() != null) {
// Get the execution based on the event's execution ID instead
execution = CommandContextUtil.getExecutionEntityManager().findById(engineEvent.getExecutionId());
}
if (execution == null) {
throw new FlowableException("No execution context active and event (" + event + ") is not related to an execution. No compensation event can be thrown.");
}
try {
ErrorPropagation.propagateError(errorCode, execution);
} catch (Exception e) {
throw new FlowableException("Error while propagating error-event for " + execution, e);
}
}
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
@Override
public boolean isFailOnException() {
return true;
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Register the error-throwing listener only for events that carry an executionId (activity-level listeners on a BPMN element, or filter event types in the dispatcher).
- Check FlowableEvent.getExecutionId() before configuring the listener to throw; skip/ignore events with null executionId in your own wrapping listener.
- Verify the execution still exists when the event fires (e.g. not after process end); if handling process-end events, propagate the error before the execution terminates.
- If the intent is compensation rather than error propagation, use a compensation-event listener with a valid scope execution instead.
Example fix
// before
globalEventListener.onEvent(anyFlowableEvent); // may have executionId == null
// after
if (flowableEvent instanceof FlowableEngineEvent e && e.getExecutionId() != null) {
errorThrowingEventListener.onEvent(flowableEvent);
} Defensive patterns
Strategy: validation
Validate before calling
// before dispatching to the listener
if (!(event instanceof FlowableEngineEvent) || ((FlowableEngineEvent) event).getExecutionId() == null) {
return; // skip error propagation for execution-less events
} Type guard
static boolean hasExecution(FlowableEvent event) {
return event instanceof FlowableEngineEvent && ((FlowableEngineEvent) event).getExecutionId() != null;
} Prevention
- Bind error-throwing listeners to activity-level BPMN elements, not global engine event dispatch.
- Filter event types in listener registration to those guaranteed to carry an executionId.
- Never propagate BPMN errors from process-end or engine-lifecycle events.
When it happens
Trigger: A FlowableEventListener of type 'error' with an errorCode is dispatched an event whose getExecutionId() is null (or whose execution entity no longer exists) while isErrorPropagationEnabled, so propagateError has no target execution.
Common situations: Listening to global/engine-level events (e.g. via a global event listener registered for all events) that are not tied to a process execution, such as job- or engine-level events; stale execution IDs after async job completion or process-end cleanup; misconfigured listener attached to the wrong event type.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Error while propagating error-event for " + execution
- Cannot throw process-instance scoped message, since the disp
- Cannot throw process-instance scoped signal, since the dispa
- Cannot create an event-throwing event-listener, unknown impl
- Unsupported entity-type for a FlowableEventListener: " + ent
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/541a473c535fe0ce.
Report an issue: GitHub.