{"record":{"id":"e482480843ce71c3","repo":"flowable/flowable-engine","slug":"execution-execution-getid-does-not-hav-e48248","errorCode":null,"errorMessage":"Execution '\" + execution.getId() + \"' does not have a variable with name: '\" + variableName + \"'.","messagePattern":"Execution '\" \\+ execution\\.getId\\(\\) \\+ \"' does not have a variable with name: '\" \\+ variableName \\+ \"'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java","lineNumber":321,"sourceCode":"                    variableFound = true;\n                }\n            }\n        } else if (variableScope == RestVariableScope.GLOBAL) {\n            // Use parent to get variables\n            if (execution.getParentId() != null) {\n                value = runtimeService.getVariable(execution.getParentId(), variableName);\n                variableScope = RestVariableScope.GLOBAL;\n                variableFound = true;\n            }\n        } else if (variableScope == RestVariableScope.LOCAL) {\n\n            value = runtimeService.getVariableLocal(execution.getId(), variableName);\n            variableScope = RestVariableScope.LOCAL;\n            variableFound = true;\n        }\n\n        if (!variableFound) {\n            throw new FlowableObjectNotFoundException(\"Execution '\" + execution.getId() + \"' does not have a variable with name: '\" + variableName + \"'.\", VariableInstanceEntity.class);\n        } else {\n            return constructRestVariable(variableName, value, variableScope, execution.getId(), includeBinary);\n        }\n    }\n\n    protected RestVariable constructRestVariable(String variableName, Object value, RestVariableScope variableScope, String executionId, boolean includeBinary) {\n\n        return restResponseFactory.createRestVariable(variableName, value, variableScope, executionId, variableType, includeBinary);\n    }\n\n    protected Execution getExecutionFromRequestWithoutAccessCheck(String executionId) {\n        Execution execution = runtimeService.createExecutionQuery().executionId(executionId).singleResult();\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find an execution with id '\" + executionId + \"'.\", Execution.class);\n        }\n        \n        return execution;\n    }","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java#L303-L339","documentation":"Variable lookup failure in BaseExecutionVariableResource: the execution was found, but neither it (local scope) nor its parent (global scope) holds a variable with the requested name, so the GET/PUT on that variable cannot proceed.","triggerScenarios":"GET /runtime/executions/{id}/variables/{name}, or internal calls from setBinaryVariable/setSimpleVariable reading current state, where the variableName is absent from the execution.","commonSituations":"Variable name typo; variable was set on a child (concurrent) execution as local, not on the requested one; variable removed on process completion; case-sensitivity mismatch.","solutions":["List all variables with GET /runtime/executions/{id}/variables and confirm the exact name","Check the variable's scope — query the correct execution (e.g. child execution) or use variableScope=local/global explicitly","Ensure the variable is created before reading it, or handle FlowableObjectNotFoundException as 'not yet set'"],"exampleFix":"// before\nGET /runtime/executions/123/variables/coutner   // typo -> 404\n// after\nGET /runtime/executions/123/variables  // discover correct names first, then GET /variables/counter","handlingStrategy":"validation","validationCode":"RestVariable[] vars = rest.getForObject(base + \"/runtime/executions/\" + id + \"/variables\", RestVariable[].class);\nboolean exists = Arrays.stream(vars).anyMatch(v -> v.getName().equals(variableName));\nif (!exists) throw new IllegalArgumentException(\"Variable '\" + variableName + \"' is not set on execution \" + id);","typeGuard":"null","tryCatchPattern":"try { return client.getExecutionVariable(id, name); } catch (HttpClientErrorException.NotFound e) { return Optional.empty(); } // treat unset variable as absent","preventionTips":["Copy variable names from GET /variables rather than hardcoding","Check child executions for local variables","Handle 'variable not set yet' as a normal state"],"tags":["rest","variables","not-found"],"backgroundTag":"resource-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"}