flowable/flowable-engine · error · FlowableException

No execution could be found for id " + executionId

Error message

No execution could be found for id " + executionId

What it means

In execute(), after findById(executionId) returns null, HandleCaseTaskErrorCmd throws FlowableException("No execution could be found for id <executionId>"). Unlike null-argument checks, this signals the id was syntactically valid but no matching execution exists in the runtime persistence.

Solutions

  1. Verify the execution still exists (runtimeService.createExecutionQuery().executionId(id)) before propagating the error.
  2. Re-resolve the executionId from the current task/plan item instead of caching a stale one.
  3. Confirm the command runs against the same engine configuration/database that owns the execution.
  4. Catch FlowableException here and treat it as an idempotent no-op if the instance is already gone.

Example fix

// before
managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, error)); // throws if gone
// after
Execution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (e != null) {
    managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, error));
}
Defensive patterns

Strategy: try-catch

Validate before calling

Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
if (exec == null) { /* skip or handle missing execution */ }

Try / catch

try {
    managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, error));
} catch (FlowableException e) {
    if (e.getMessage() != null && e.getMessage().contains("No execution could be found")) {
        log.warn("Execution {} already gone; skipping error propagation", executionId);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Executing HandleCaseTaskErrorCmd with an executionId for an execution that was deleted, already ended, belongs to another engine/database, or was never created (stale or wrong id).

Common situations: Race where the case instance terminated before error propagation ran; environment mismatch (test id used against prod DB); id stored and reused after process cleanup; tenant/database misconfiguration.

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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/HandleCaseTaskErrorCmd.java:58

    protected BusinessError error;

    public HandleCaseTaskErrorCmd(String executionId, BusinessError error) {
        if (executionId == null) {
            throw new FlowableIllegalArgumentException("executionId is null");
        }
        if (error == null) {
            throw new FlowableIllegalArgumentException("error is null");
        }
        this.executionId = executionId;
        this.error = error;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getExecutionEntityManager().findById(executionId);
        if (execution == null) {
            throw new FlowableException("No execution could be found for id " + executionId);
        }

        ErrorPropagation.propagateError(error, execution);
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)