flowable/flowable-engine · error · ActivitiException

Compensating execution not set for compensate event…

Error message

Compensating execution not set for compensate event subscription with id ${eventSubscription.getId()}

What it means

CompensationEventHandler handles compensation event subscriptions. The subscription's configuration must store the id of the compensating execution; if the configuration is null the handler throws ActivitiException because it cannot locate the execution that will run the compensation handler.

Solutions

  1. Verify the event subscription row's CONFIGURATION_ column contains a valid execution id; fix data if corrupted
  2. Redeploy and restart the affected process instances rather than repairing subscriptions by hand
  3. Check engine/migration scripts populated compensation subscription configuration for the version in use
Defensive patterns

Strategy: validation

Validate before calling

EventSubscriptionEntity sub = /* load subscription */;
if (sub.getConfiguration() == null) {
    throw new IllegalStateException("Compensation subscription missing compensating execution id");
}

Type guard

boolean hasCompensatingExecution(EventSubscriptionEntity s) {
    return s != null && s.getConfiguration() != null;
}

Try / catch

try {
    runtimeService.startProcessInstanceByKey("proc"); // trigger compensation flow
} catch (ActivitiException e) {
    if (e.getMessage() != null && e.getMessage().contains("Compensating execution not set")) {
        // subscription data corrupted; restart instance / fix data
    }
}

Prevention

When it happens

Trigger: handleEvent on a COMPENSATE EventSubscriptionEntity whose getConfiguration() returns null — corrupted or legacy subscription data missing the compensating execution reference.

Common situations: Engine version upgrades/migrations where compensation subscription configuration wasn't populated; manual database edits or data corruption; throwing compensation in a process whose subscription state is inconsistent.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/2dd1afdf2d0f3c00. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/event/CompensationEventHandler.java:48

/**
 * @author Daniel Meyer
 */
public class CompensationEventHandler implements EventHandler {

    public static final String EVENT_HANDLER_TYPE = "compensate";

    @Override
    public String getEventHandlerType() {
        return EVENT_HANDLER_TYPE;
    }

    @Override
    public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {

        String configuration = eventSubscription.getConfiguration();
        if (configuration == null) {
            throw new ActivitiException("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId());
        }

        ExecutionEntity compensatingExecution = commandContext.getExecutionEntityManager()
                .findExecutionById(configuration);

        ActivityImpl compensationHandler = eventSubscription.getActivity();

        if ((compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION) == null
                || !(Boolean) compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION))
                && compensationHandler.isScope()) {

            // descend into scope:
            List<CompensateEventSubscriptionEntity> eventsForThisScope = compensatingExecution.getCompensateEventSubscriptions();
            ScopeUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false);

        } else {
            try {

View on GitHub (pinned to d6d39ce1c6)