flowable/flowable-engine · error · IllegalStateException

No flow element with id

Error message

No flow element with id <elementId> found in bpmnmodel <processId>

What it means

DynamicProcessDefinitionSummary.getElement looks up a FlowElement by id in the process definition's BpmnModel to summarize its properties. If no element with that id exists, it throws IllegalStateException, indicating the requested element id is not part of the model.

Solutions

  1. Verify the elementId exists in the deployed BPMN model before querying
  2. Check which process definition the summary was constructed from and use element ids from that same definition
  3. Catch IllegalStateException and return a friendly 'element not found' response to the client

Example fix

// before
ObjectNode props = summary.getElement(elementId);
// after
FlowElement fe = summary.getBpmnModel().getFlowElement(elementId);
if (fe == null) {
    throw new IllegalArgumentException("Unknown element id: " + elementId);
}
ObjectNode props = summary.getElement(elementId);
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = bpmnModel.getFlowElement(elementId) != null;

Type guard

function elementExists(summary, id) { try { return summary.getElement(id) != null; } catch (IllegalStateException e) { return false; } }

Try / catch

try { node = summary.getElement(elementId); } catch (IllegalStateException e) { return ResponseEntity.status(404).body("Unknown element id"); }

Prevention

When it happens

Trigger: Calling getElement(elementId) (directly or via getSummary()/jsonNode()) with an elementId absent from the BpmnModel — e.g. querying a changed/deleted element id against the original model, or an id from a different process definition.

Common situations: Dynamic process injection UIs requesting info for an element that was never deployed; mismatch between the process definition the summary was built for and the element ids supplied; case-sensitivity or whitespace issues in element ids.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/dynamic/DynamicProcessDefinitionSummary.java:94

     * <li>
     * UserTask
     * </li>
     * <li>
     * ScriptTask
     * </li>
     * </ul> No summary will field will be created for other elements. ElementId, and elementType will be available.
     * 
     * @param elementId
     *            the id of the {@link org.flowable.bpmn.model.FlowElement}.
     * @return an {@link ObjectNode} with the provided structure.
     * @throws IllegalStateException
     *             if no {@link org.flowable.bpmn.model.FlowElement} is found for the provided id.
     */
    public ObjectNode getElement(String elementId) throws IllegalStateException {

        FlowElement flowElement = bpmnModel.getFlowElement(elementId);
        if (flowElement == null) {
            throw new IllegalStateException("No flow element with id " + elementId + " found in bpmnmodel " + bpmnModel.getMainProcess().getId());
        }

        PropertiesParser propertiesParser = summaryParsers.get(flowElement.getClass().getSimpleName());
        ObjectNode bpmnProperties = getBpmnProperties(elementId, processInfo);
        if (propertiesParser != null) {
            return propertiesParser.parseElement(flowElement, bpmnProperties, objectMapper);
        } else {
            // if there is no parser for an element we have to use the default summary parser.
            return defaultParser.parseElement(flowElement, bpmnProperties, objectMapper);
        }
    }

    public ObjectNode getSummary() {
        ObjectNode summary = objectMapper.createObjectNode();

        for (Process process : bpmnModel.getProcesses()) {
            for (FlowElement flowElement : process.getFlowElements()) {
                summary.set(flowElement.getId(), getElement(flowElement.getId()));

View on GitHub (pinned to d6d39ce1c6)