flowable/flowable-engine · error · FlowableIllegalArgumentException

Active execution could not be found with activity id

Error message

Active execution could not be found with activity id ${activityId}

What it means

After filtering the process instance's child executions by currentActivityId, none were active at the requested activity. Change-state requires at least one live execution sitting at the target source activity.

Solutions

  1. Confirm the source activity id matches an active execution: runtimeService.createExecutionQuery().processInstanceId(id).activityId(actId).list()
  2. Check the BPMN model id spelling (case-sensitive) for the current flow element
  3. If the activity lives in an embedded subprocess/callActivity scope, use the proper move-operation variant or move the parent scope first

Example fix

// before
.moveActivityIdTo("reviewTask", "approveTask") // reviewTask already completed
// after
List<Execution> execs = runtimeService.createExecutionQuery().processInstanceId(piId).activityId("reviewTask").list();
if (!execs.isEmpty()) { /* changeState */ }
Defensive patterns

Strategy: validation

Validate before calling

List<Execution> active = runtimeService.createExecutionQuery().processInstanceId(piId).activityId(fromActivityId).list();
if (active.isEmpty()) throw new IllegalStateException("No active execution at " + fromActivityId);

Try / catch

try { builder.changeState(); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().startsWith("Active execution could not be found")) { /* correct ids or abort */ } else throw e; }

Prevention

When it happens

Trigger: moveActivityIdTo(fromActivityId, toActivityId) or similar where fromActivityId is not the current activity of any active execution (task already completed, activity inside a non-active subprocess, or wrong activity id).

Common situations: Trying to move from an activity that already finished; activity ids in subprocesses/multi-instance bodies needing scoped ids; spelling differences between BPMN XML ids and the ids passed in; async activities not yet started.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java:328

        }

        if (!processExecution.isProcessInstanceType()) {
            throw new FlowableException("Execution is not a process instance type execution for id " + processInstanceId);
        }

        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processExecution.getProcessDefinitionId())) {
            throw new FlowableException("Flowable 5 process definitions are not supported");
        }

        List<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(processExecution.getId());

        List<ExecutionEntity> executions = childExecutions.stream()
            .filter(e -> e.getCurrentActivityId() != null)
            .filter(e -> e.getCurrentActivityId().equals(activityId))
            .collect(Collectors.toList());

        if (executions.isEmpty()) {
            throw new FlowableIllegalArgumentException("Active execution could not be found with activity id " + activityId);
        }

        return executions;
    }

    protected MoveExecutionEntityContainer createMoveExecutionEntityContainer(MoveActivityIdContainer activityContainer, List<ExecutionEntity> executions, CommandContext commandContext) {
        MoveExecutionEntityContainer moveExecutionEntityContainer = new MoveExecutionEntityContainer(executions, 
                activityContainer.getMoveToActivityIds(), activityContainer.getActivityOptions());
        if (moveExecutionEntityContainer.getActivityOptions() != null) {
            activityContainer.setActivityOptions(moveExecutionEntityContainer.getActivityOptions());
        }

        if (activityContainer.isMoveToParentProcess()) {
            ExecutionEntity processInstanceExecution = executions.get(0).getProcessInstance();
            ExecutionEntity superExecution = processInstanceExecution.getSuperExecution();
            if (superExecution == null) {
                throw new FlowableException("No parent process found for execution with activity id " + executions.get(0).getCurrentActivityId());
            }

View on GitHub (pinned to d6d39ce1c6)