{"record":{"id":"275008d1cab1ddb4","repo":"flowable/flowable-engine","slug":"already-taking-a-transition","errorCode":null,"errorMessage":"already taking a transition","messagePattern":"already taking a transition","errorType":"exception","errorClass":"PvmException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/ExecutionImpl.java","lineNumber":587,"sourceCode":"        try {\n            activityBehavior.signal(this, signalName, signalData);\n        } catch (RuntimeException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new PvmException(\"couldn't process signal '\" + signalName + \"' on activity '\" + activity.getId() + \"': \" + e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public void take(PvmTransition transition, boolean fireActivityCompletedEvent) {\n        // No event firing on executionlevel impl\n        take(transition);\n    }\n\n    @Override\n    public void take(PvmTransition transition) {\n        if (this.transition != null) {\n            throw new PvmException(\"already taking a transition\");\n        }\n        if (transition == null) {\n            throw new PvmException(\"transition is null\");\n        }\n        setTransition((TransitionImpl) transition);\n        performOperation(AtomicOperation.TRANSITION_NOTIFY_LISTENER_END);\n    }\n\n    @Override\n    public void executeActivity(PvmActivity activity) {\n        setActivity((ActivityImpl) activity);\n        performOperation(AtomicOperation.ACTIVITY_START);\n    }\n\n    @Override\n    public List<ActivityExecution> findInactiveConcurrentExecutions(PvmActivity activity) {\n        List<ActivityExecution> inactiveConcurrentExecutionsInActivity = new ArrayList<>();\n        List<ActivityExecution> otherConcurrentExecutions = new ArrayList<>();","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/ExecutionImpl.java#L569-L605","documentation":"A PvmException indicating ExecutionImpl.take(transition) was called on an execution that already holds a transition — i.e. it is already moving between activities. The PVM forbids double take() to prevent corrupting the execution's transition state. This is an internal state-guard, so hitting it usually signals a bug or invalid concurrent use.","triggerScenarios":"Calling take(transition) twice on the same ExecutionImpl without the transition having been consumed (e.g. a custom behavior or listener calls take() while the engine is already performing a transition); concurrent threads signalling/taking the same execution.","commonSituations":"Custom ExecutionListeners on transition end calling execution.take(); behaviors like parallel gateways implemented incorrectly calling takeAll/take re-entrantly; async listeners racing on the same execution instance.","solutions":["Remove duplicate take() calls in custom behavior/listener code","Check for re-entrancy: ensure listeners don't call take() during TRANSITION_NOTIFY_LISTENER_* operations","Synchronize access if multiple threads signal the same execution","Verify custom gateway behaviors only call take()/takeAll() once per execution"],"exampleFix":"// before\npublic void notify(DelegateExecution exec) {\n  exec.take(exec.getActivity().getOutgoingFlows().get(0)); // engine already taking\n}\n// after\npublic void notify(DelegateExecution exec) {\n  // just record state; let the engine take the transition\n  exec.setVariable(\"notified\", true);\n}","handlingStrategy":"validation","validationCode":"// guard custom code that might take a transition\nif (((ExecutionImpl) execution).getTransition() != null) {\n  throw new IllegalStateException(\"execution is already transitioning\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call take() from execution listeners","Call take()/takeAll() exactly once per execution","Synchronize concurrent signal paths on the execution"],"tags":["process-engine","concurrency","invalid-state"],"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"}