flowable/flowable-engine · error · FlowableIllegalArgumentException
Unknown variable type ${variableType}
Error message
Unknown variable type ${variableType} What it means
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.
Source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java:115
if (planItemInstance == null) {
throw new FlowableObjectNotFoundException("Could not find a plan item instance", CaseInstance.class);
}
if (restApiInterceptor != null) {
restApiInterceptor.accessPlanItemInstanceVariable(planItemInstance, variableName);
}
return getVariableFromRequestWithoutAccessCheck(planItemInstance.getId(), variableName, CmmnRestResponseFactory.VARIABLE_PLAN_ITEM, includeBinary);
}
protected RestVariable getVariableFromRequestWithoutAccessCheck(String instanceId, String variableName, int variableType, boolean includeBinary) {
Object value = null;
if (variableType == CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {
value = runtimeService.getLocalVariable(instanceId, variableName);
} else if (variableType == CmmnRestResponseFactory.VARIABLE_CASE) {
value = runtimeService.getVariable(instanceId, variableName);
} else {
throw new FlowableIllegalArgumentException("Unknown variable type " + variableType);
}
if (value == null) {
if (variableType == CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {
throw new FlowableObjectNotFoundException(
"Plan item instance '" + instanceId + "' doesn't have a variable with name: '" + variableName + "'.",
VariableInstance.class);
} else {
throw new FlowableObjectNotFoundException(
"Case instance '" + instanceId + "' doesn't have a variable with name: '" + variableName + "'.",
VariableInstance.class);
}
}
//we use null for the scope, because the extraction from request does not require the scope
return constructRestVariable(variableName, value, instanceId, variableType, includeBinary, null);
}
View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before int type = CmmnRestResponseFactory.VARIABLE_TASK; // BPMN constant, unknown here // after int type = CmmnRestResponseFactory.VARIABLE_PLAN_ITEM;
Defensive patterns
Strategy: validation
Validate before calling
if (variableType !== CmmnRestResponseFactory.VARIABLE_CASE && variableType !== CmmnRestResponseFactory.VARIABLE_PLAN_ITEM) {
throw new Error('variableType must be VARIABLE_CASE or VARIABLE_PLAN_ITEM');
} Type guard
const isCmmnVariableType = (t) => t === CmmnRestResponseFactory.VARIABLE_CASE || t === CmmnRestResponseFactory.VARIABLE_PLAN_ITEM;
Try / catch
catch (e) { if (e instanceof FlowableIllegalArgumentException) { /* fix constant */ } } Prevention
- Only use CmmnRestResponseFactory constants from the CMMN module
- Add exhaustive checks when extending BaseVariableResource
- Avoid copy-pasting BPMN REST code into CMMN endpoints
When it happens
Trigger: Direct/internal calls to getVariableFromRequestWithoutAccessCheck with a variableType other than CmmnRestResponseFactory.VARIABLE_CASE or VARIABLE_PLAN_ITEM (called by getVariableFromRequest, setSimpleVariable, setBinaryVariable).
Common situations: 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.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Variable name in the body should be equal to the name used i
- Plan item instance '${id}' does not have a variable '${varia
- Variable operation is missing for variable: ${name}
- Variable name is required
- Task '
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a576101688741688.
Report an issue: GitHub.