{"record":{"id":"594e5cd98947e460","repo":"flowable/flowable-engine","slug":"variable-value-is-missing-for-variable-variable","errorCode":null,"errorMessage":"Variable value is missing for variable: ${variable.getName()}","messagePattern":"Variable value is missing for variable: (.+?)","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/caze/HistoricCaseInstanceBaseResource.java","lineNumber":315,"sourceCode":"    }\n\n    protected HistoricCaseInstance getHistoricCaseInstanceFromRequestWithoutAccessCheck(String caseInstanceId) {\n        HistoricCaseInstance caseInstance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();\n        if (caseInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a case instance with id '\" + caseInstanceId + \"'.\", HistoricCaseInstance.class);\n        }\n\n        return caseInstance;\n    }\n\n    protected void addVariables(HistoricCaseInstanceQuery caseInstanceQuery, List<QueryVariable> variables) {\n        for (QueryVariable variable : variables) {\n            if (variable.getVariableOperation() == null) {\n                throw new FlowableIllegalArgumentException(\"Variable operation is missing for variable: \" + variable.getName());\n            }\n            if (variable.getVariableOperation() != QueryVariableOperation.EXISTS && variable.getVariableOperation() != QueryVariableOperation.NOT_EXISTS) {\n                if (variable.getValue() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable value is missing for variable: \" + variable.getName());\n                }\n            }\n\n            boolean nameLess = variable.getName() == null;\n\n            Object actualValue = restResponseFactory.getVariableValue(variable);\n\n            // A value-only query is only possible using equals-operator\n            if (nameLess && variable.getVariableOperation() != QueryVariableOperation.EQUALS) {\n                throw new FlowableIllegalArgumentException(\"Value-only query (without a variable-name) is only supported when using 'equals' operation.\");\n            }\n\n            switch (variable.getVariableOperation()) {\n\n            case EQUALS:\n                if (nameLess) {\n                    caseInstanceQuery.variableValueEquals(actualValue);\n                } else {","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/caze/HistoricCaseInstanceBaseResource.java#L297-L333","documentation":"Guard in HistoricCaseInstanceBaseResource.addVariables: a query variable was supplied whose name is set but whose value is missing/null, so the variable comparison for the historic case instance query cannot be built.","triggerScenarios":"POST query payload with {\"name\":\"x\",\"operation\":\"equals\"} and no \"value\" key (or explicit null).","commonSituations":"Templates with placeholder value left empty; client serializes null and omits value; developer assumed EXISTS-like semantics for equals.","solutions":["Provide a value for every variable that is not EXISTS/NOT_EXISTS","Switch to operation \"exists\" if you only need to test variable presence","Validate the payload before posting (name+operation+value triplet)","Send a typed default value if the business case allows it"],"exampleFix":"// before\n{\"name\":\"amount\",\"operation\":\"greaterThan\"}\n// after\n{\"name\":\"amount\",\"operation\":\"greaterThan\",\"value\":100}","handlingStrategy":"validation","validationCode":"if (!\"exists\".equals(op) && !\"notExists\".equals(op) && value == null)\n  throw new IllegalArgumentException(\"Variable \" + name + \" requires a value\");","typeGuard":"boolean valuePresent(Map<String,Object> v) {\n  String op = (String) v.get(\"operation\");\n  return \"exists\".equals(op) || \"notExists\".equals(op) || v.get(\"value\") != null;\n}","tryCatchPattern":"try { ... } catch (FlowableIllegalArgumentException e) {\n  return badRequest(e.getMessage());\n}","preventionTips":["Supply a value for every non-exists operation","Use exists/notExists for presence checks","Add payload validation on the client"],"tags":["rest-api","validation","query","missing-field"],"backgroundTag":"missing-required-argument","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"}