{"record":{"id":"e734ef52f1bb6761","repo":"flowable/flowable-engine","slug":"execution-executionid-doesn-t-exist-e734ef","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/GetExecutionVariableCmd.java","lineNumber":56,"sourceCode":"    public GetExecutionVariableCmd(String executionId, String variableName, boolean isLocal) {\n        this.executionId = executionId;\n        this.variableName = variableName;\n        this.isLocal = isLocal;\n    }\n\n    @Override\n    public Object 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        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            return compatibilityHandler.getExecutionVariable(executionId, variableName, isLocal);\n        }\n\n        Object value;\n\n        if (isLocal) {\n            value = execution.getVariableLocal(variableName, false);\n        } else {\n            value = execution.getVariable(variableName, false);\n        }\n\n        return value;\n    }\n}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableCmd.java#L38-L74","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nObject v = runtimeService.getVariable(executionId, \"orderState\");\n// after\nExecution exec = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nObject v = (exec != null)\n    ? runtimeService.getVariable(executionId, \"orderState\")\n    : historyService.createHistoricVariableInstanceQuery()\n        .executionId(executionId).variableName(\"orderState\")\n        .singleResult();","handlingStrategy":"validation","validationCode":"boolean exists = runtimeService.createExecutionQuery()\n    .executionId(executionId).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.getVariable(executionId, name);\n} catch (FlowableObjectNotFoundException e) {\n    // execution finished: read from historyService historic variable query\n}","preventionTips":["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"],"tags":["flowable","execution","variable","not-found"],"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-18T11:17:12.947Z"}