flowable/flowable-engine · error · FlowableObjectNotFoundException

execution ${executionId} doesn't exist

Error message

execution ${executionId} doesn't exist

What it means

Flowable throws FlowableObjectNotFoundException when no ExecutionEntity exists for the given executionId in GetExecutionVariableInstanceCmd. The id is well-formed but does not reference a live execution row (executions are deleted when process instances end or scopes complete). Message: 'execution <id> doesn't exist'.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableInstanceCmd.java:53

    public GetExecutionVariableInstanceCmd(String executionId, String variableName, boolean isLocal) {
        this.executionId = executionId;
        this.variableName = variableName;
        this.isLocal = isLocal;
    }

    @Override
    public VariableInstance execute(CommandContext commandContext) {
        if (executionId == null) {
            throw new FlowableIllegalArgumentException("executionId is null");
        }
        if (variableName == null) {
            throw new FlowableIllegalArgumentException("variableName is null");
        }

        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);

        if (execution == null) {
            throw new FlowableObjectNotFoundException("execution " + executionId + " doesn't exist", Execution.class);
        }

        VariableInstance variableEntity = null;
        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {
            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
            variableEntity = compatibilityHandler.getExecutionVariableInstance(executionId, variableName, isLocal);

        } else {
            if (isLocal) {
                variableEntity = execution.getVariableInstanceLocal(variableName, false);
            } else {
                variableEntity = execution.getVariableInstance(variableName, false);
            }
        }

        return variableEntity;
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the execution id against a live query (RuntimeService#createExecutionQuery#executionId) before fetching variables
  2. Re-fetch the execution/variables via the process instance id instead of a stale execution id
  3. Catch FlowableObjectNotFoundException and treat the variable as gone
  4. Confirm the API call runs against the same engine/database the execution was created in

Example fix

// before
VariableInstance vi = runtimeService.getVariableInstance(executionId, "status");
// after
Execution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
VariableInstance vi = (e != null) ? runtimeService.getVariableInstance(executionId, "status") : null;
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

try { ... } catch (FlowableObjectNotFoundException e) { /* handle missing execution */ }

Prevention

When it happens

Trigger: RuntimeService.getVariableInstance(staleExecutionId, name) where the execution was deleted between obtaining the id and the query; concurrent process-instance end; referencing an execution from a different engine instance/datasource.

Common situations: Job or async listener firing after the process instance finished; caching execution ids across transactions; pointing a client at a dev database while the id came from prod; missing process engine version/tenant mismatch.

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