{"record":{"id":"416d67ca688f98f9","repo":"flowable/flowable-engine","slug":"execution-executionid-doesn-t-exist-416d67","errorCode":null,"errorMessage":"execution ${executionId} doesn't exist","messagePattern":"execution (.+?) doesn't exist","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableInstanceCmd.java","lineNumber":53,"sourceCode":"    public GetExecutionVariableInstanceCmd(String executionId, String variableName, boolean isLocal) {\n        this.executionId = executionId;\n        this.variableName = variableName;\n        this.isLocal = isLocal;\n    }\n\n    @Override\n    public VariableInstance execute(CommandContext commandContext) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n\n        ExecutionEntity execution = CommandContextUtil.getExecutionEntityManager(commandContext).findById(executionId);\n\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"execution \" + executionId + \" doesn't exist\", Execution.class);\n        }\n\n        VariableInstance variableEntity = null;\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            variableEntity = compatibilityHandler.getExecutionVariableInstance(executionId, variableName, isLocal);\n\n        } else {\n            if (isLocal) {\n                variableEntity = execution.getVariableInstanceLocal(variableName, false);\n            } else {\n                variableEntity = execution.getVariableInstance(variableName, false);\n            }\n        }\n\n        return variableEntity;\n    }\n}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableInstanceCmd.java#L35-L71","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the execution id against a live query (RuntimeService#createExecutionQuery#executionId) before fetching variables","Re-fetch the execution/variables via the process instance id instead of a stale execution id","Catch FlowableObjectNotFoundException and treat the variable as gone","Confirm the API call runs against the same engine/database the execution was created in"],"exampleFix":"// before\nVariableInstance vi = runtimeService.getVariableInstance(executionId, \"status\");\n// after\nExecution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nVariableInstance vi = (e != null) ? runtimeService.getVariableInstance(executionId, \"status\") : null;","handlingStrategy":"try-catch","validationCode":"Execution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nif (e == null) throw new IllegalStateException(\"Execution not found: \" + executionId);","typeGuard":null,"tryCatchPattern":"try { ... } catch (FlowableObjectNotFoundException e) { /* handle missing execution */ }","preventionTips":["Don't persist execution ids beyond the process lifetime","Re-resolve ids from business keys","Check history for finished instances"],"tags":["flowable","entity-not-found","stale-id"],"backgroundTag":"entity-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}