{"record":{"id":"c5dfdb81cd58cd76","repo":"flowable/flowable-engine","slug":"execution-executionid-doesn-t-exist-c5dfdb","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/GetExecutionVariableInstancesCmd.java","lineNumber":54,"sourceCode":"\n    public GetExecutionVariableInstancesCmd(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, VariableInstance> 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        Map<String, VariableInstance> variables = null;\n\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            variables = compatibilityHandler.getExecutionVariableInstances(executionId, variableNames, isLocal);\n\n        } else {\n\n            if (variableNames == null || variableNames.isEmpty()) {\n                // Fetch all\n                if (isLocal) {\n                    variables = execution.getVariableInstancesLocal();\n                } else {\n                    variables = execution.getVariableInstances();\n                }\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetExecutionVariableInstancesCmd.java#L36-L72","documentation":"Flowable throws FlowableObjectNotFoundException when the executionId passed to GetExecutionVariableInstancesCmd refers to no existing execution. The id passes the null check but findById returns null, meaning the execution row is absent. Message: 'execution <id> doesn't exist'.","triggerScenarios":"RuntimeService.getVariableInstances(deletedExecutionId); id from a process instance that already ended; typo'd or truncated id; wrong engine datasource.","commonSituations":"Long-running integrations storing ids in external tables past the process lifetime; test data cleanup; database switch between environments.","solutions":["Confirm the execution exists via RuntimeService#createExecutionQuery before querying variables","Look up variables from the process instance id which survives via history, or enable history to retrieve past variables","Catch FlowableObjectNotFoundException and handle the 'execution gone' case explicitly","Verify the same database/engine is being queried"],"exampleFix":"// before\nMap<String, VariableInstance> vars = runtimeService.getVariableInstances(executionId);\n// after\nExecution e = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\nif (e == null) throw new IllegalStateException(\"Execution gone: \" + executionId);\nMap<String, VariableInstance> vars = runtimeService.getVariableInstances(executionId);","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) { /* execution gone — fallback to history or empty map */ }","preventionTips":["Use process instance ids for long-lived references","Enable history for post-completion variable access","Keep id storage and engine database in sync"],"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"}