{"record":{"id":"3a20f42de370bb49","repo":"flowable/flowable-engine","slug":"variablevalue-is-null","errorCode":null,"errorMessage":"variableValue is null","messagePattern":"variableValue is null","errorType":"validation","errorClass":"org.flowable.common.engine.api.FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java","lineNumber":196,"sourceCode":"        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQuery variableName(String variableName) {\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n        this.variableName = variableName;\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQuery variableValueEquals(String variableName, Object variableValue) {\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n        if (variableValue == null) {\n            throw new FlowableIllegalArgumentException(\"variableValue is null\");\n        }\n        this.variableName = variableName;\n        queryVariableValue = new QueryVariableValue(variableName, variableValue, QueryOperator.EQUALS, true);\n        return this;\n    }\n\n    @Override\n    public HistoricVariableInstanceQuery variableValueNotEquals(String variableName, Object variableValue) {\n        if (variableName == null) {\n            throw new FlowableIllegalArgumentException(\"variableName is null\");\n        }\n        if (variableValue == null) {\n            throw new FlowableIllegalArgumentException(\"variableValue is null\");\n        }\n        this.variableName = variableName;\n        queryVariableValue = new QueryVariableValue(variableName, variableValue, QueryOperator.NOT_EQUALS, true);\n        return this;\n    }","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/HistoricVariableInstanceQueryImpl.java#L178-L214","documentation":"Flowable throws this when variableValueEquals(name, value) receives a null variableValue. Null is not a legal equality target here because variable value comparisons are done in SQL via typed conversion; to query for variables without a value use a different mechanism rather than passing null. Thrown in HistoricVariableInstanceQueryImpl.variableValueEquals().","triggerScenarios":"Calling .variableValueEquals(name, null) — e.g. passing an object that was expected to be initialized, an unboxed wrapper from a cache miss, or a deserialized null.","commonSituations":"Map.get() returning null for a missing key; optional config values defaulting to null; endpoints forwarding request-supplied values verbatim.","solutions":["Pass a real value; verify where the null came from.","Use Objects.requireNonNull(value) early so failures surface at the right place.","If 'no value' is a legitimate filter, filter by variableName and check nullity of results in application code instead."],"exampleFix":"// before\nquery.variableValueEquals(\"status\", null);\n\n// after\nObject status = getConfig(\"status\", \"ACTIVE\");\nquery.variableValueEquals(\"status\", status);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(variableValue, \"variableValue must not be null\");\nquery.variableValueEquals(name, variableValue);","typeGuard":"boolean hasValue(Object v) { return v != null; }","tryCatchPattern":"try {\n    query.variableValueEquals(name, value);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Null value passed to variableValueEquals: {}\", e.getMessage());\n    // skip the filter or supply a default\n}","preventionTips":["Provide defaults for values that may be absent before querying.","Remember null equality is unsupported — model 'unset' differently.","Use Optional.orElse(default) instead of orElse(null) at query-build sites."],"tags":["flowable","null-check","query-builder","java"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}