{"record":{"id":"e840f8e35c71d0de","repo":"flowable/flowable-engine","slug":"no-execution-associated-call-businessprocess-asso","errorCode":null,"errorMessage":"No execution associated. Call businessProcess.associateExecutionById() or businessProcess.startTask() first.","messagePattern":"No execution associated\\. Call businessProcess\\.associateExecutionById\\(\\) or businessProcess\\.startTask\\(\\) first\\.","errorType":"exception","errorClass":"FlowableCdiException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cdi/src/main/java/org/flowable/cdi/BusinessProcess.java","lineNumber":504,"sourceCode":"    /**\n     * Returns the {@link ProcessInstance} currently associated or 'null'\n     *\n     * @throws FlowableCdiException if no {@link Execution} is associated. Use {@link #isAssociated()} to check whether an association exists.\n     */\n    public ProcessInstance getProcessInstance() {\n        Execution execution = getExecution();\n        if (execution != null && !(execution.getProcessInstanceId().equals(execution.getId()))) {\n            return processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId()).singleResult();\n        }\n        return (ProcessInstance) execution;\n    }\n\n    // internal implementation\n    // //////////////////////////////////////////////////////////\n\n    protected void assertAssociated() {\n        if (associationManager.getExecution() == null) {\n            throw new FlowableCdiException(\"No execution associated. Call businessProcess.associateExecutionById() or businessProcess.startTask() first.\");\n        }\n    }\n\n    protected void assertTaskAssociated() {\n        if (associationManager.getTask() == null) {\n            throw new FlowableCdiException(\"No task associated. Call businessProcess.startTask() first.\");\n        }\n    }\n\n    protected Map<String, Object> getCachedVariables() {\n        return associationManager.getCachedVariables();\n    }\n\n    protected Map<String, Object> getAndClearCachedVariables() {\n        Map<String, Object> beanStore = getCachedVariables();\n        Map<String, Object> copy = new HashMap<>(beanStore);\n        beanStore.clear();\n        return copy;","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cdi/src/main/java/org/flowable/cdi/BusinessProcess.java#L486-L522","documentation":"assertAssociated() enforces that a CDI-managed Execution is associated with the conversation before operations like triggerExecution run. Without a prior associateExecutionById() or startTask(), the engine has no execution to signal, so it throws FlowableCdiException.","triggerScenarios":"Calling businessProcess.triggerExecution(...) (or other execution-scoped operations) in a conversation where neither startTask nor associateExecutionById was called, or after the association was cleared (e.g. end of process).","commonSituations":"Resuming a CDI conversation after a redeploy/restart losing the association; forgetting the bootstrap call in a JSF bean action; the associated process instance completed meanwhile.","solutions":["Call businessProcess.associateExecutionById(executionId) (or startTask) before triggerExecution in the same conversation.","Store the process instance id in the CDI conversation and re-associate on conversation restore.","Catch FlowableCdiException and re-derive/restart context when the association cannot be recovered."],"exampleFix":"// before\nbusinessProcess.triggerExecution(); // no association\n// after\nbusinessProcess.associateExecutionById(processInstanceId);\nbusinessProcess.triggerExecution();","handlingStrategy":"try-catch","validationCode":"if (!businessProcess.isAssociated()) {\n  businessProcess.associateExecutionById(savedProcessInstanceId);\n}","typeGuard":"boolean executionAssociated() {\n  return businessProcess.isAssociated();\n}","tryCatchPattern":"try {\n  businessProcess.triggerExecution();\n} catch (FlowableCdiException e) {\n  // no association: re-associate from stored id or fail gracefully\n}","preventionTips":["Always startTask/associateExecutionById at conversation start","Persist the process instance id in CDI conversation scope","Handle association loss after restarts/redeploys"],"tags":["flowable","cdi","execution","association"],"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-14T05:17:10.506Z"}