{"record":{"id":"16fc3e8831fd9b65","repo":"flowable/flowable-engine","slug":"execution-executionid-doesn-t-exist-16fc3e","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/GetExecutionVariablesCmd.java","lineNumber":57,"sourceCode":"\n    public GetExecutionVariablesCmd(String executionId, Collection<String> variableNames, boolean isLocal) {\n        this.executionId = executionId;\n        this.variableNames = variableNames;\n        this.isLocal = isLocal;\n    }\n\n    @Override\n    public Map<String, Object> execute(CommandContext commandContext) {\n\n        // Verify existence of execution\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId 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.getExecutionVariables(executionId, variableNames, isLocal);\n        }\n\n        if (variableNames == null || variableNames.isEmpty()) {\n\n            // Fetch all\n\n            if (isLocal) {\n                return execution.getVariablesLocal();\n            } else {\n                return execution.getVariables();\n            }\n\n        } else {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariablesCmd.java#L39-L75","documentation":"Flowable throws FlowableObjectNotFoundException when the executionId given to GetExecutionVariablesCmd does not match any execution in the database. The id is non-null but resolves to nothing, so the command aborts. Message: 'execution <id> doesn't exist'.","triggerScenarios":"RuntimeService.getVariables(staleExecutionId) after the execution completed; ids from another engine/cluster; manually fabricated ids.","commonSituations":"Async jobs outliving the process; user-facing UIs holding ids across page reloads while the instance finished; environment drift (test id against prod engine).","solutions":["Re-resolve a current execution id before reading variables","Catch FlowableObjectNotFoundException and return a sensible default/empty result","Use the history service (HistoricVariableInstanceQuery) for variables of finished instances","Verify engine/database targeting"],"exampleFix":"// before\nMap<String, Object> vars = runtimeService.getVariables(executionId);\n// after\ntry {\n    Map<String, Object> vars = runtimeService.getVariables(executionId);\n} catch (FlowableObjectNotFoundException e) {\n    Map<String, Object> vars = historyService.createHistoricVariableInstanceQuery()\n        .executionId(executionId).list().stream()\n        .collect(Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue));\n}","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) { /* fall back to HistoricVariableInstanceQuery */ }","preventionTips":["Treat finished-instance lookups as history queries","Re-resolve current ids before reads","Catch and degrade gracefully in UIs"],"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"}