{"record":{"id":"4ebda7d333edfb19","repo":"flowable/flowable-engine","slug":"cannot-disassociate-execution-no-annotation-ex","errorCode":null,"errorMessage":"Cannot disassociate execution, no ${annotation} execution associated. ","messagePattern":"Cannot disassociate execution, no (.+?) execution associated\\. ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/context/DefaultContextAssociationManager.java","lineNumber":171,"sourceCode":"        Execution associatedExecution = scopedAssociation.getExecution();\r\n        if (associatedExecution != null && !associatedExecution.getId().equals(execution.getId())) {\r\n            throw new FlowableCdiException(\"Cannot associate \" + execution + \", already associated with \" + associatedExecution + \". Disassociate first!\");\r\n        }\r\n\r\n        if (LOGGER.isTraceEnabled()) {\r\n            LOGGER.trace(\"Associating {} (@{})\", execution, scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName());\r\n        }\r\n        scopedAssociation.setExecution(execution);\r\n    }\r\n\r\n    @Override\r\n    public void disAssociate() {\r\n        if (Context.getCommandContext() != null) {\r\n            throw new FlowableCdiException(\"Cannot work with scoped associations inside command context.\");\r\n        }\r\n        ScopedAssociation scopedAssociation = getScopedAssociation();\r\n        if (scopedAssociation.getExecution() == null) {\r\n            throw new FlowableException(\"Cannot disassociate execution, no \" + scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName() + \" execution associated. \");\r\n        }\r\n        if (LOGGER.isTraceEnabled()) {\r\n            LOGGER.trace(\"Disassociating\");\r\n        }\r\n        scopedAssociation.setExecution(null);\r\n        scopedAssociation.setTask(null);\r\n    }\r\n\r\n    @Override\r\n    public String getExecutionId() {\r\n        Execution execution = getExecution();\r\n        if (execution != null) {\r\n            return execution.getId();\r\n        } else {\r\n            return null;\r\n        }\r\n    }\r\n\r","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/context/DefaultContextAssociationManager.java#L153-L189","documentation":"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').","triggerScenarios":"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.","commonSituations":"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.","solutions":["Guard the call: only disAssociate if an execution is currently associated (track it yourself or check via a query).","Make cleanup idempotent by catching/ignoring this exception, or use a boolean flag around association lifetime.","Ensure associateExecution was actually invoked before the disassociate in the same CDI scope."],"exampleFix":"// before\ntry { ... } finally { businessProcess.disAssociate(); }\n// after\ntry { ... } finally {\n  if (associated) { businessProcess.disAssociate(); associated = false; }\n}","handlingStrategy":"try-catch","validationCode":"boolean hasAssociation = /* association flag maintained by your app */ false;\nif (hasAssociation) businessProcess.disAssociate();","typeGuard":"null","tryCatchPattern":"try { businessProcess.disAssociate(); } catch (FlowableException e) { /* nothing associated; safe to ignore */ }","preventionTips":["Track association state in application code and guard disAssociate calls","Make cleanup idempotent; tolerate 'nothing associated' as success","Associate in the same CDI scope before attempting to disassociate"],"tags":["cdi","no-association","disassociate"],"backgroundTag":"invalid-state-transition","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"}