{"record":{"id":"250f9b41f84c5150","repo":"flowable/flowable-engine","slug":"variable-value-is-missing-for-variable-variable-250f9b","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/task/HistoricTaskInstanceBaseResource.java","lineNumber":329,"sourceCode":"     * Throws the right exceptions when bad request was made or instance was not found.\n     */\n    protected HistoricTaskInstance getHistoricTaskInstanceFromRequestWithoutAccessCheck(String taskId) {\n        HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();\n        if (taskInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a task instance with id '\" + taskId + \"'.\", HistoricTaskInstance.class);\n        }\n        \n        return taskInstance;\n    }\n\n    protected void addTaskVariables(HistoricTaskInstanceQuery taskInstanceQuery, 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) {\n                throw new FlowableIllegalArgumentException(\"Value-only query (without a variable-name) is not supported.\");\n            }\n\n            switch (variable.getVariableOperation()) {\n\n            case EQUALS:\n                taskInstanceQuery.taskVariableValueEquals(variable.getName(), actualValue);\n                break;\n","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/task/HistoricTaskInstanceBaseResource.java#L311-L347","documentation":"FlowableIllegalArgumentException thrown when a historic task query variable requires a value but has none. Operations other than EXISTS/NOT_EXISTS are value-based, so variable.getValue() == null makes the query condition meaningless and the request is rejected as invalid (HTTP 400).","triggerScenarios":"POST /cmmn-history/historic-task-instances/query with a variable such as {\"name\":\"owner\",\"operation\":\"EQUALS\"} and no value, or explicit \"value\":null for any non-EXISTS/NOT_EXISTS operation.","commonSituations":"Client code leaving the value field unset; trying to query for null values with EQUALS instead of using EXISTS/NOT_EXISTS semantics; template-generated requests with empty value placeholders.","solutions":["Provide a non-null \"value\" for the variable, e.g. {\"name\":\"owner\",\"operation\":\"EQUALS\",\"value\":\"kermit\"}.","If you intend to test variable presence, use operation EXISTS or NOT_EXISTS, which do not require a value.","Validate each variable (operation != EXISTS/NOT_EXISTS implies value != null) before sending the request.","For null-value semantics, restructure the query (e.g. filter by variable existence) since equality on null is not supported here."],"exampleFix":"// before\n{\"name\":\"owner\",\"operation\":\"EQUALS\"}\n// after\n{\"name\":\"owner\",\"operation\":\"EQUALS\",\"value\":\"kermit\"}","handlingStrategy":"validation","validationCode":"function validateQueryVars(vars) {\n  for (const v of vars.taskVariableValues || []) {\n    const op = v.operation;\n    if (op !== \"EXISTS\" && op !== \"NOT_EXISTS\" && (v.value === undefined || v.value === null)) {\n      throw new Error(\"variable '\" + v.name + \"' with operation \" + op + \" requires a value\");\n    }\n  }\n}","typeGuard":"const needsValue = (v) => v.operation !== \"EXISTS\" && v.operation !== \"NOT_EXISTS\";","tryCatchPattern":null,"preventionTips":["Use EXISTS/NOT_EXISTS for presence checks instead of null values.","Never rely on JSON null to represent 'no value' in variable filters.","Validate operation/value pairing before each request."],"tags":["flowable","rest","validation","query"],"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"}