flowable/flowable-engine · error · FlowableException

Execution is not a process instance type execution for id

Error message

Execution is not a process instance type execution for id ${processInstanceId}

What it means

The execution id resolved to an entity that exists but is not a process-instance-type execution (e.g. a child/concurrent execution or a sub-execution). resolveActiveExecutions requires the id to point at the root process instance execution because change-state operations are anchored on the process instance.

Solutions

  1. Pass the root process instance id (execution with isProcessInstanceType()==true / ExecutionQuery.processInstanceId)
  2. Resolve the parent process instance: runtimeService.createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId())
  3. Audit id sources to guarantee the id originates from a ProcessInstance, not an Execution listing

Example fix

// before
String id = execution.getId(); // child execution
// after
String id = execution.getProcessInstanceId(); // root process instance
Defensive patterns

Strategy: type-guard

Validate before calling

ExecutionEntity e = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(id).singleResult();
boolean isRoot = e != null && e.isProcessInstanceType();

Type guard

boolean isProcessInstanceRoot(Execution e) { return e instanceof ExecutionEntity && ((ExecutionEntity) e).isProcessInstanceType(); }

Prevention

When it happens

Trigger: Passing a child execution id, a concurrent execution id, or a sub-process-branch execution id to createChangeActivityStateBuilder().processInstanceId(...) instead of the root process instance id.

Common situations: Fetching an Execution from runtimeService.createExecutionQuery() and reusing one of its child execution ids; confusing execution.getId() with processInstanceId in multi-instance/parallel-gateway flows.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        }

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

        return execution;
    }

    protected List<ExecutionEntity> resolveActiveExecutions(String processInstanceId, String activityId, CommandContext commandContext) {
        ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);
        ExecutionEntity processExecution = executionEntityManager.findById(processInstanceId);

        if (processExecution == null) {
            throw new FlowableException("Execution could not be found with id " + processInstanceId);
        }

        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;

View on GitHub (pinned to d6d39ce1c6)