flowable/flowable-engine · error · FlowableException

Cannot disassociate execution, no

Error message

Cannot disassociate execution, no ${annotation} execution associated. 

What it means

disAssociate() throws this FlowableException when the current scoped association holds no execution, i.e. there is nothing to clear. The message embeds the association scope's annotation simple name (e.g. 'no ConversationScoped execution associated').

Solutions

  1. Guard the call: only disAssociate if an execution is currently associated (track it yourself or check via a query).
  2. Make cleanup idempotent by catching/ignoring this exception, or use a boolean flag around association lifetime.
  3. Ensure associateExecution was actually invoked before the disassociate in the same CDI scope.

Example fix

// before
try { ... } finally { businessProcess.disAssociate(); }
// after
try { ... } finally {
  if (associated) { businessProcess.disAssociate(); associated = false; }
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean hasAssociation = /* association flag maintained by your app */ false;
if (hasAssociation) businessProcess.disAssociate();

Type guard

null

Try / catch

try { businessProcess.disAssociate(); } catch (FlowableException e) { /* nothing associated; safe to ignore */ }

Prevention

When it happens

Trigger: Calling businessProcess.disAssociate() when setExecution/associateExecution was never called in this scope, the scope is fresh (new conversation/request), or a previous disAssociate already cleared it.

Common situations: Defensive cleanup code that runs disAssociate unconditionally in a finally block on a fresh scope; double-invocation after an earlier cleanup; conversation ended and restarted so association state reset.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/context/DefaultContextAssociationManager.java:171

        Execution associatedExecution = scopedAssociation.getExecution();
        if (associatedExecution != null && !associatedExecution.getId().equals(execution.getId())) {
            throw new FlowableCdiException("Cannot associate " + execution + ", already associated with " + associatedExecution + ". Disassociate first!");
        }

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Associating {} (@{})", execution, scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName());
        }
        scopedAssociation.setExecution(execution);
    }

    @Override
    public void disAssociate() {
        if (Context.getCommandContext() != null) {
            throw new FlowableCdiException("Cannot work with scoped associations inside command context.");
        }
        ScopedAssociation scopedAssociation = getScopedAssociation();
        if (scopedAssociation.getExecution() == null) {
            throw new FlowableException("Cannot disassociate execution, no " + scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName() + " execution associated. ");
        }
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Disassociating");
        }
        scopedAssociation.setExecution(null);
        scopedAssociation.setTask(null);
    }

    @Override
    public String getExecutionId() {
        Execution execution = getExecution();
        if (execution != null) {
            return execution.getId();
        } else {
            return null;
        }
    }

View on GitHub (pinned to d6d39ce1c6)