flowable/flowable-engine · error · FlowableObjectNotFoundException

No execution found for id ''

Error message

No execution found for id ''

What it means

CompleteAdhocSubProcessCmd completes an ad-hoc sub-process execution. If no execution exists for the given executionId, Flowable throws FlowableObjectNotFoundException with ExecutionEntity as the missing type.

Source

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

/**
 * @author Tijs Rademakers
 */
public class CompleteAdhocSubProcessCmd implements Command<Void>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String executionId;

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

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

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

        List<? extends ExecutionEntity> childExecutions = execution.getExecutions();
        if (childExecutions.size() > 0) {
            throw new FlowableException("Ad-hoc sub process has running child executions that need to be completed first. " + execution);
        }

        ExecutionEntity outgoingFlowExecution = executionEntityManager.createChildExecution(execution.getParent());
        outgoingFlowExecution.setCurrentFlowElement(execution.getCurrentFlowElement());

        executionEntityManager.deleteExecutionAndRelatedData(execution, null, false);

        CommandContextUtil.getAgenda().planTakeOutgoingSequenceFlowsOperation(outgoingFlowExecution, true);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the execution exists via runtimeService.createExecutionQuery().executionId(id).singleResult().
  2. Refresh the executionId from a fresh process instance lookup instead of caching it.
  3. Ensure the process instance has not already completed/terminated before calling the API.

Example fix

// before
runtimeService.completeAdhocSubProcess(executionId, outcome);
// after
ExecutionEntity e = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (e != null) {
    runtimeService.completeAdhocSubProcess(executionId, outcome);
}
Defensive patterns

Strategy: validation

Validate before calling

Execution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (e == null) {
    throw new IllegalArgumentException("Execution not found: " + executionId);
}

Try / catch

try {
    runtimeService.completeAdhocSubProcess(executionId, outcome);
} catch (FlowableObjectNotFoundException e) {
    // execution gone; refresh process state
}

Prevention

When it happens

Trigger: runtimeService.completeAdhocSubProcess(executionId, ...) with an execution id that was deleted, already completed, or never existed.

Common situations: Stale execution ids held after the process instance ended; typo'd or cross-instance ids; async completion racing deletion of the execution.

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