{"record":{"id":"a576101688741688","repo":"flowable/flowable-engine","slug":"unknown-variable-type-variabletype","errorCode":null,"errorMessage":"Unknown variable type ${variableType}","messagePattern":"Unknown variable type (.+?)","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java","lineNumber":115,"sourceCode":"        if (planItemInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a plan item instance\", CaseInstance.class);\n        }\n\n        if (restApiInterceptor != null) {\n            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","sourceCodeStart":97,"sourceCodeEnd":133,"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#L97-L133","documentation":"getVariableFromRequestWithoutAccessCheck branches on an internal variableType flag (VARIABLE_CASE or VARIABLE_PLAN_ITEM) to decide which runtimeService call to use; any other value triggers FlowableIllegalArgumentException 'Unknown variable type'. This is an internal dispatch guard, hit when caller code passes an unexpected type constant.","triggerScenarios":"Direct/internal calls to getVariableFromRequestWithoutAccessCheck with a variableType other than CmmnRestResponseFactory.VARIABLE_CASE or VARIABLE_PLAN_ITEM (called by getVariableFromRequest, setSimpleVariable, setBinaryVariable).","commonSituations":"Custom subclasses or extensions of BaseVariableResource passing a new constant without adding a branch; refactoring that removed/renamed a constant; copy-pasted code from the process (BPMN) REST module using its constants.","solutions":["Only pass CmmnRestResponseFactory.VARIABLE_CASE or VARIABLE_PLAN_ITEM","If adding a new scope type, extend the if/else branch in getVariableFromRequestWithoutAccessCheck","Don't reuse BPMN REST response-factory constants in the CMMN module"],"exampleFix":"// before\nint type = CmmnRestResponseFactory.VARIABLE_TASK; // BPMN constant, unknown here\n// after\nint type = CmmnRestResponseFactory.VARIABLE_PLAN_ITEM;","handlingStrategy":"validation","validationCode":"if (variableType !== CmmnRestResponseFactory.VARIABLE_CASE && variableType !== CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {\n  throw new Error('variableType must be VARIABLE_CASE or VARIABLE_PLAN_ITEM');\n}","typeGuard":"const isCmmnVariableType = (t) => t === CmmnRestResponseFactory.VARIABLE_CASE || t === CmmnRestResponseFactory.VARIABLE_PLAN_ITEM;","tryCatchPattern":"catch (e) { if (e instanceof FlowableIllegalArgumentException) { /* fix constant */ } }","preventionTips":["Only use CmmnRestResponseFactory constants from the CMMN module","Add exhaustive checks when extending BaseVariableResource","Avoid copy-pasting BPMN REST code into CMMN endpoints"],"tags":["rest-api","internal-invariant","variables","cmmn"],"backgroundTag":"internal-invariant-violation","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"}