flowable/flowable-engine · error · ActivitiException

Default sequence flow

Error message

Default sequence flow '${defaultSequenceFlow}' could not be not found

What it means

BpmnActivityBehavior.performOutgoingBehavior() looks up the outgoing transition whose id matches the activity's default sequence flow. When a default flow is configured but no outgoing transition with that id exists on the activity, it throws ActivitiException because the process would otherwise end silently with no route taken.

Solutions

  1. Add or fix the sequence flow so its id matches the activity's default attribute
  2. Remove the default attribute if no default flow is intended
  3. Validate the BPMN model at deploy time with a model validator to catch dangling default-flow references

Example fix

// before
<sequenceFlow id="flow1" sourceRef="task1" targetRef="task2"/>
<task id="task1" flowable:default="defaultFlow"/>
// after
<sequenceFlow id="defaultFlow" sourceRef="task1" targetRef="task2"/>
<task id="task1" flowable:default="defaultFlow"/>
Defensive patterns

Strategy: validation

Validate before calling

boolean defaultExists = activity.getOutgoingFlows().stream()
    .anyMatch(f -> f.getId().equals(defaultFlowId));
if (!defaultExists) throw new IllegalStateException("default flow not found: " + defaultFlowId);

Try / catch

try { runtimeService.startProcessInstanceByKey(key); }
catch (ActivitiException e) { if (e.getMessage().contains("Default sequence flow")) { /* fix model */ } throw e; }

Prevention

When it happens

Trigger: A BPMN activity (task/gateway) defines attribute default='someFlowId' but no sequence flow with id 'someFlowId' leaves the activity, and no other conditional flow's condition evaluates true so the default is consulted.

Common situations: BPMN XML refactors where a sequence flow was renamed or deleted while the default attribute still referenced the old id; hand-edited or generated process models with dangling flowId references.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java:158

            execution.take(transitionsToTake.get(0));

        } else if (transitionsToTake.size() >= 1) {

            execution.inactivate();
            if (reusableExecutions == null || reusableExecutions.isEmpty()) {
                execution.takeAll(transitionsToTake, Collections.singletonList(execution));
            } else {
                execution.takeAll(transitionsToTake, reusableExecutions);
            }

        } else {

            if (defaultSequenceFlow != null) {
                PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow);
                if (defaultTransition != null) {
                    execution.take(defaultTransition);
                } else {
                    throw new ActivitiException("Default sequence flow '" + defaultSequenceFlow + "' could not be not found");
                }
            } else {

                Object isForCompensation = execution.getActivity().getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION);
                if (isForCompensation != null && (Boolean) isForCompensation) {
                    if (execution instanceof ExecutionEntity) {
                        Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution);
                    }
                    InterpretableExecution parentExecution = (InterpretableExecution) execution.getParent();
                    ((InterpretableExecution) execution).remove();
                    parentExecution.signal("compensationDone", null);

                } else {

                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("No outgoing sequence flow found for {}. Ending execution.", execution.getActivity().getId());
                    }
                    execution.end();

View on GitHub (pinned to d6d39ce1c6)