flowable/flowable-engine · error · FlowableObjectNotFoundException

No execution found for id

Error message

No execution found for id '${executionId}'

What it means

Thrown by GetEnabledActivitiesForAdhocSubProcessCmd.execute() when no ExecutionEntity exists for the supplied executionId. Flowable looks up the execution via the ExecutionEntityManager and raises FlowableObjectNotFoundException if findById returns null, i.e. the execution was never created, has completed, or the id is wrong.

Solutions

  1. Verify the executionId exists: query RuntimeService.createExecutionQuery().executionId(id).singleResult() before calling.
  2. Ensure you pass the executionId of the execution whose current flow element is the ad-hoc subprocess, not the process instance id unless that is the ad-hoc execution.
  3. Re-fetch the id after any process progression; ids become invalid once the execution finishes.
  4. Confirm you are connected to the same database the process ran on (correct datasource/schema in flowable config).

Example fix

// before
runtimeService.getEnabledActivitiesForAdhocSubProcess("untrusted-id");
// after
Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (exec != null) {
    runtimeService.getEnabledActivitiesForAdhocSubProcess(executionId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (executionId == null || runtimeService.createExecutionQuery().executionId(executionId).count() == 0) {
    throw new IllegalArgumentException("execution does not exist: " + executionId);
}

Try / catch

try {
    runtimeService.getEnabledActivitiesForAdhocSubProcess(executionId);
} catch (FlowableObjectNotFoundException e) {
    // refresh execution id from RuntimeService or treat as finished
}

Prevention

When it happens

Trigger: Calling RuntimeService.getEnabledActivitiesForAdhocSubProcess(executionId) (or executing this command directly) with an execution id that does not exist in ACT_RU_EXECUTION.

Common situations: Using a stale id after the ad-hoc subprocess execution ended; copying a processInstanceId instead of an executionId; typo'd id from external storage; querying on a different engine/datasource than the one that ran the process.

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/ecaa5b79b29bf5fe. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEnabledActivitiesForAdhocSubProcessCmd.java:46

import org.flowable.engine.impl.util.CommandContextUtil;

/**
 * @author Tijs Rademakers
 */
public class GetEnabledActivitiesForAdhocSubProcessCmd implements Command<List<FlowNode>>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String executionId;

    public GetEnabledActivitiesForAdhocSubProcessCmd(String executionId) {
        this.executionId = executionId;
    }

    @Override
    public List<FlowNode> execute(CommandContext commandContext) {
        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);
        if (execution == null) {
            throw new FlowableObjectNotFoundException("No execution found for id '" + executionId + "'", ExecutionEntity.class);
        }

        if (!(execution.getCurrentFlowElement() instanceof AdhocSubProcess adhocSubProcess)) {
            throw new FlowableException("The current flow element of the requested " + execution + " is not an ad-hoc sub process");
        }

        List<FlowNode> enabledFlowNodes = new ArrayList<>();

        // if sequential ordering, only one child execution can be active, so no enabled activities
        if (adhocSubProcess.hasSequentialOrdering()) {
            if (execution.getExecutions().size() > 0) {
                return enabledFlowNodes;
            }
        }

        for (FlowElement flowElement : adhocSubProcess.getFlowElements()) {
            if (flowElement instanceof FlowNode flowNode) {
                if (flowNode.getIncomingFlows().size() == 0) {

View on GitHub (pinned to d6d39ce1c6)