{"record":{"id":"ee8430d44942fb4a","repo":"flowable/flowable-engine","slug":"invalid-targetelementid-targetelementid-no-e","errorCode":null,"errorMessage":"Invalid targetElementId '${targetElementId}': no element found for this id n process definition '${processDefinitionId}'","messagePattern":"Invalid targetElementId '(.+?)': no element found for this id n process definition '(.+?)'","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ExecutionGraphUtil.java","lineNumber":65,"sourceCode":"        if (sourceFlowElement instanceof FlowNode) {\n            sourceElement = (FlowNode) sourceFlowElement;\n        } else if (sourceFlowElement instanceof SequenceFlow) {\n            sourceElement = (FlowNode) ((SequenceFlow) sourceFlowElement).getTargetFlowElement();\n        }\n\n        FlowElement targetFlowElement = process.getFlowElement(targetElementId, true);\n        FlowNode targetElement = null;\n        if (targetFlowElement instanceof FlowNode) {\n            targetElement = (FlowNode) targetFlowElement;\n        } else if (targetFlowElement instanceof SequenceFlow) {\n            targetElement = (FlowNode) ((SequenceFlow) targetFlowElement).getTargetFlowElement();\n        }\n\n        if (sourceElement == null) {\n            throw new FlowableException(\"Invalid sourceElementId '\" + sourceElementId + \"': no element found for this id n process definition '\" + processDefinitionId + \"'\");\n        }\n        if (targetElement == null) {\n            throw new FlowableException(\"Invalid targetElementId '\" + targetElementId + \"': no element found for this id n process definition '\" + processDefinitionId + \"'\");\n        }\n\n        Set<String> visitedElements = new HashSet<>();\n        return isReachable(process, sourceElement, targetElement, visitedElements);\n    }\n\n    public static boolean isReachable(Process process, FlowNode sourceElement, FlowNode targetElement, Set<String> visitedElements) {\n        \n        // Special case: start events in an event subprocess might exist as an execution and are most likely be able to reach the target\n        // when the target is in the event subprocess, but should be ignored as they are not 'real' runtime executions (but rather waiting for a trigger)\n        if (sourceElement instanceof StartEvent && isInEventSubprocess(sourceElement)) {\n            return false;\n        }\n\n        // No outgoing seq flow: could be the end of eg . the process or an embedded subprocess\n        if (sourceElement.getOutgoingFlows().size() == 0) {\n            visitedElements.add(sourceElement.getId());\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/util/ExecutionGraphUtil.java#L47-L83","documentation":"Same validation as the source-side error but for the target element: isReachable resolves targetElementId, resolving through SequenceFlow to its target node if needed. If no element (or no sequence flow target) exists for targetElementId in the given process definition, the traversal cannot be performed and this FlowableException is thrown.","triggerScenarios":"Calling public isReachable(processDefinitionId, sourceElementId, targetElementId) where targetElementId is absent from the process model, or it names a SequenceFlow whose getTargetFlowElement() resolves to null (e.g. a dangling sequence flow with no target).","commonSituations":"Target id typo; referencing a target from a different definition version; malformed BPMN with a sequence flow lacking a valid target after model edits; using ids from an externally edited diagram that no longer match the deployed model.","solutions":["Verify the targetElementId exists in the deployed process model and fix the id.","If the id points at a SequenceFlow, ensure that flow has a valid target flow element in the BPMN XML.","Confirm processDefinitionId matches the definition version containing that target element.","Guard the call by checking model.getFlowElement(targetElementId) != null first."],"exampleFix":"// before\nboolean ok = isReachable(processDefinitionId, \"taskA\", \"taskZ\");\n\n// after\nBpmnModel model = repositoryService.getBpmnModel(processDefinitionId);\nFlowElement target = model.getFlowElement(\"endEvent\");\nif (target != null) {\n    boolean ok = isReachable(processDefinitionId, \"taskA\", \"endEvent\");\n}","handlingStrategy":"validation","validationCode":"BpmnModel model = repositoryService.getBpmnModel(processDefinitionId);\nFlowElement target = model.getFlowElement(targetElementId);\nif (target == null || (target instanceof SequenceFlow && ((SequenceFlow) target).getTargetFlowElement() == null)) {\n    throw new IllegalArgumentException(\"targetElementId \" + targetElementId + \" invalid\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure sequence flows have valid targets in BPMN XML (schema validation on deploy)","Match target ids to the exact definition version","Validate ids against the model before graph queries"],"tags":["process-model","invalid-id","graph-traversal"],"backgroundTag":"invalid-argument-value","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"}