{"record":{"id":"f9e1c2aeb12ab678","repo":"flowable/flowable-engine","slug":"plan-item-instance-instanceid-doesn-t-have-a","errorCode":null,"errorMessage":"Plan item instance '${instanceId}' doesn't have a variable with name: '${variableName}'.","messagePattern":"Plan item 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":120,"sourceCode":"            restApiInterceptor.accessPlanItemInstanceVariable(planItemInstance, variableName);\n        }\n        return getVariableFromRequestWithoutAccessCheck(planItemInstance.getId(), variableName, CmmnRestResponseFactory.VARIABLE_PLAN_ITEM, includeBinary);\n    }\n\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","sourceCodeStart":102,"sourceCodeEnd":138,"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#L102-L138","documentation":"When the requested variable name is not present on the plan item instance, runtimeService.getLocalVariable returns null and the method throws FlowableObjectNotFoundException scoped to VariableInstance. This is a per-instance variable lookup failure, not a global variable absence.","triggerScenarios":"GET/PUT/DELETE of a variable on a plan-item variable endpoint where the variableName does not exist locally on that plan item instance.","commonSituations":"Variable set on the case (process-level) scope but read with the plan-item local endpoint; variable created after the request; case-sensitive name mismatch; variable removed by another actor.","solutions":["List existing plan item variables first (GET plan-item variables collection) to confirm the name","Read case-scoped variables via the case-instance variable endpoint if the variable lives at case scope","Check name spelling/case exactly","Use history variable endpoints if the plan item already completed"],"exampleFix":"// before\nGET /cmmn-runtime/plan-item-instances/{id}/variables/caseVar // local lookup misses case-scoped var\n// after\nGET /cmmn-runtime/case-instances/{caseId}/variables/caseVar","handlingStrategy":"try-catch","validationCode":"const vars = await fetch(`/cmmn-runtime/plan-item-instances/${id}/variables`);\nconst names = (await vars.json()).map(v => v.name);\nif (!names.includes(variableName)) throw new Error('Variable not present locally: ' + variableName);","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) {\n  if (e instanceof FlowableObjectNotFoundException) { /* check case-scope or history */ }\n}","preventionTips":["List existing variables before accessing a single one","Distinguish case-scope vs plan-item local variables","Match variable names exactly (case-sensitive)"],"tags":["rest-api","variables","not-found","plan-item-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-14T05:17:10.506Z"}