flowable/flowable-engine · error · FlowableObjectNotFoundException
Case instance '${instanceId}' doesn't have a variable with n
Error message
Case instance '${instanceId}' doesn't have a variable with name: '${variableName}'. What it means
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.
Source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java:124
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);
}
protected byte[] getVariableDataByteArray(CaseInstance caseInstance, String variableName, HttpServletResponse response) {
RestVariable variable = getVariableFromRequest(caseInstance, variableName, true);
return restVariableDataToRestResponse(variable, response);
}
protected byte[] getVariableDataByteArray(PlanItemInstance planItemInstance, String variableName, HttpServletResponse response) {
RestVariable variable = getVariableFromRequest(planItemInstance, variableName, true);
return restVariableDataToRestResponse(variable, response);
}View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before
GET /cmmn-runtime/case-instances/{id}/variables/Assignee // wrong case
// after
GET /cmmn-runtime/case-instances/{id}/variables/assignee Defensive patterns
Strategy: try-catch
Validate before calling
const vars = await fetch(`/cmmn-runtime/case-instances/${caseId}/variables`);
const names = (await vars.json()).map(v => v.name);
if (!names.includes(variableName)) throw new Error('Variable not present on case: ' + variableName); Try / catch
try { ... } catch (e) {
if (e instanceof FlowableObjectNotFoundException) { /* check plan-item scope or history */ }
} Prevention
- 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
When it happens
Trigger: GET/PUT/DELETE of a single variable on a case-instance variable endpoint where variableName is not set on the case instance.
Common situations: 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).
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Could not find a case instance
- No case instance found for id ${caseInstanceId}
- No case instance found for id ${caseInstanceId}
- The variable does not have a binary data stream.
- Could not find a case instance with id '${caseInstanceId}'.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/bcfb0d7f9fb121b9.
Report an issue: GitHub.