flowable/flowable-engine · error · FlowableObjectNotFoundException
execution doesn't exist
Error message
execution ${executionId} doesn't exist What it means
After validating arguments, GetExecutionVariableCmd looks up the execution and throws FlowableObjectNotFoundException if findById returns null — the execution id is valid syntactically but no such execution row exists, so the variable cannot be read.
Solutions
- Confirm the execution exists: runtimeService.createExecutionQuery().executionId(id).singleResult() before the getVariable call.
- If the process already ended, read the variable via historyService.createHistoricVariableInstanceQuery().processInstanceId(...).variableName(...).
- Verify the id source: use execution.getId() from a live query result, not a cached value.
- Check engine datasource configuration to ensure you hit the right database.
Example fix
// before
Object v = runtimeService.getVariable(executionId, "orderState");
// after
Execution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
Object v = (exec != null)
? runtimeService.getVariable(executionId, "orderState")
: historyService.createHistoricVariableInstanceQuery()
.executionId(executionId).variableName("orderState")
.singleResult(); Defensive patterns
Strategy: validation
Validate before calling
boolean exists = runtimeService.createExecutionQuery()
.executionId(executionId).count() > 0; Try / catch
try {
runtimeService.getVariable(executionId, name);
} catch (FlowableObjectNotFoundException e) {
// execution finished: read from historyService historic variable query
} Prevention
- Re-resolve execution ids before variable access
- Use history APIs once executions complete
- Never persist runtime execution ids for later use without revalidation
- Verify datasource consistency across deployments
When it happens
Trigger: Calling RuntimeService.getVariable(executionId, variableName) with an execution id not present in ACT_RU_EXECUTION (finished execution, wrong id, or id from a different engine/database).
Common situations: Reading a variable after the process execution completed and its runtime rows were deleted; stale ids stored externally; mixing runtime API with historic data; multi-datasource 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
- Cannot associate execution by id: no execution with id '
- Cannot find execution with id
- Cannot find process instance with id
- Cannot find process instance with id
- Could not find an execution with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e734ef52f1bb6761.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java:56
public GetExecutionVariableCmd(String executionId, String variableName, boolean isLocal) {
this.executionId = executionId;
this.variableName = variableName;
this.isLocal = isLocal;
}
@Override
public Object 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);
}
if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {
Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
return compatibilityHandler.getExecutionVariable(executionId, variableName, isLocal);
}
Object value;
if (isLocal) {
value = execution.getVariableLocal(variableName, false);
} else {
value = execution.getVariable(variableName, false);
}
return value;
}
}View on GitHub (pinned to d6d39ce1c6)