{"record":{"id":"3b0d530ef9ec96b9","repo":"flowable/flowable-engine","slug":"availablebefore-is-null","errorCode":null,"errorMessage":"availableBefore is null","messagePattern":"availableBefore is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java","lineNumber":363,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceCreatedAfter(Date createdAfter) {\n        if (createdAfter == null) {\n            throw new FlowableIllegalArgumentException(\"createdAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.createdAfter = createdAfter;\n        } else {\n            this.createdAfter = createdAfter;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastAvailableBefore(Date availableBefore) {\n        if (availableBefore == null) {\n            throw new FlowableIllegalArgumentException(\"availableBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastAvailableBefore = availableBefore;\n        } else {\n            this.lastAvailableBefore = availableBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastAvailableAfter(Date availableAfter) {\n        if (availableAfter == null) {\n            throw new FlowableIllegalArgumentException(\"availableAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastAvailableAfter = availableAfter;\n        } else {\n            this.lastAvailableAfter = availableAfter;","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L345-L381","documentation":"Thrown by PlanItemInstanceQueryImpl.planItemInstanceLastAvailableBefore when the availableBefore Date is null. This filter bounds the last time a plan item was available; the builder rejects a null bound immediately.","triggerScenarios":"Calling planItemInstanceLastAvailableBefore(null), e.g. with a nullable timestamp from an upstream service or request.","commonSituations":"Dashboard time-range filters where the end bound is optional; a null from a date-conversion utility for malformed input.","solutions":["Pass a valid java.util.Date for the bound.","Skip the call when no upper bound is desired.","Validate date inputs at the API boundary before constructing the query."],"exampleFix":"// before\nquery.planItemInstanceLastAvailableBefore(to); // to may be null\n// after\nif (to != null) {\n    query.planItemInstanceLastAvailableBefore(to);\n}","handlingStrategy":"validation","validationCode":"if (availableBefore != null) {\n    planItemInstanceQuery.planItemInstanceLastAvailableBefore(availableBefore);\n}","typeGuard":"boolean isPresent(Date d) {\n    return d != null;\n}","tryCatchPattern":"try {\n    query.planItemInstanceLastAvailableBefore(availableBefore);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"availableBefore is null\")) {\n        // skip the filter or return a 400 to the client\n    } else {\n        throw e;\n    }\n}","preventionTips":["Ensure date deserializers fail loudly on malformed input rather than producing null","Null-check timestamps from upstream services before filtering","Keep query-building code in one validated helper method"],"tags":["cmmn","query","null-argument","date","flowable"],"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"}