{"record":{"id":"bcfb0d7f9fb121b9","repo":"flowable/flowable-engine","slug":"case-instance-instanceid-doesn-t-have-a-varia","errorCode":null,"errorMessage":"Case instance '${instanceId}' doesn't have a variable with name: '${variableName}'.","messagePattern":"Case instance '(.+?)' doesn't have a variable with name: '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java","lineNumber":124,"sourceCode":"\n    protected RestVariable getVariableFromRequestWithoutAccessCheck(String instanceId, String variableName, int variableType, boolean includeBinary) {\n        Object value = null;\n\n        if (variableType == CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {\n            value = runtimeService.getLocalVariable(instanceId, variableName);\n        } else if (variableType == CmmnRestResponseFactory.VARIABLE_CASE) {\n            value = runtimeService.getVariable(instanceId, variableName);\n        } else {\n            throw new FlowableIllegalArgumentException(\"Unknown variable type \" + variableType);\n        }\n\n        if (value == null) {\n            if (variableType == CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {\n                throw new FlowableObjectNotFoundException(\n                        \"Plan item instance '\" + instanceId + \"' doesn't have a variable with name: '\" + variableName + \"'.\",\n                        VariableInstance.class);\n            } else {\n                throw new FlowableObjectNotFoundException(\n                        \"Case instance '\" + instanceId + \"' doesn't have a variable with name: '\" + variableName + \"'.\",\n                        VariableInstance.class);\n            }\n        }\n\n        //we use null for the scope, because the extraction from request does not require the scope\n        return constructRestVariable(variableName, value, instanceId, variableType, includeBinary, null);\n    }\n\n    protected byte[] getVariableDataByteArray(CaseInstance caseInstance, String variableName, HttpServletResponse response) {\n        RestVariable variable = getVariableFromRequest(caseInstance, variableName, true);\n        return restVariableDataToRestResponse(variable, response);\n    }\n\n    protected byte[] getVariableDataByteArray(PlanItemInstance planItemInstance, String variableName, HttpServletResponse response) {\n        RestVariable variable = getVariableFromRequest(planItemInstance, variableName, true);\n        return restVariableDataToRestResponse(variable, response);\n    }","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java#L106-L142","documentation":"When variableType is VARIABLE_CASE and runtimeService.getVariable returns null, the method throws FlowableObjectNotFoundException stating the case instance has no such variable. It distinguishes a missing variable from other lookup errors, targeting VariableInstance as the missing entity.","triggerScenarios":"GET/PUT/DELETE of a single variable on a case-instance variable endpoint where variableName is not set on the case instance.","commonSituations":"Variable never created; variable lives at plan-item local scope instead of case scope; typo or case mismatch in variable name; reading variables of an already-completed case instance (gone from runtime).","solutions":["List all case variables first (GET case-instance variables) to verify the name","If the variable is local to a plan item, query the plan-item variable endpoint","Fix variable name spelling/case","Use history variable queries for completed case instances"],"exampleFix":"// before\nGET /cmmn-runtime/case-instances/{id}/variables/Assignee // wrong case\n// after\nGET /cmmn-runtime/case-instances/{id}/variables/assignee","handlingStrategy":"try-catch","validationCode":"const vars = await fetch(`/cmmn-runtime/case-instances/${caseId}/variables`);\nconst names = (await vars.json()).map(v => v.name);\nif (!names.includes(variableName)) throw new Error('Variable not present on case: ' + variableName);","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) {\n  if (e instanceof FlowableObjectNotFoundException) { /* check plan-item scope or history */ }\n}","preventionTips":["Verify case instance is still active (runtime) before querying","List all case variables to confirm the name","Route plan-item-local variable reads to the plan-item endpoint"],"tags":["rest-api","variables","not-found","case-instance"],"backgroundTag":"record-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"}