{"record":{"id":"681db57a9224461c","repo":"flowable/flowable-engine","slug":"unavailablebefore-is-null","errorCode":null,"errorMessage":"unavailableBefore is null","messagePattern":"unavailableBefore 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":389,"sourceCode":"    }\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;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastUnavailableBefore(Date unavailableBefore) {\n        if (unavailableBefore == null) {\n            throw new FlowableIllegalArgumentException(\"unavailableBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastUnavailableBefore = unavailableBefore;\n        } else {\n            this.lastUnavailableBefore = unavailableBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastUnavailableAfter(Date unavailableAfter) {\n        if (unavailableAfter == null) {\n            throw new FlowableIllegalArgumentException(\"unavailableAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastUnavailableAfter = unavailableAfter;\n        } else {\n            this.lastUnavailableAfter = unavailableAfter;","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L371-L407","documentation":"Thrown by PlanItemInstanceQueryImpl.planItemInstanceLastUnavailableBefore when the unavailableBefore Date is null. The builder requires a concrete date for this upper bound on the last-unavailable timestamp and fails fast on null.","triggerScenarios":"Calling planItemInstanceLastUnavailableBefore(null), typically via a nullable variable feeding a time-range filter.","commonSituations":"Optional end-date filters in monitoring/reporting UIs; null results from lenient date parsing of invalid strings.","solutions":["Pass a valid java.util.Date for the bound.","Only invoke the filter when the date is non-null; combine with planItemInstanceLastUnavailableAfter for a range.","Validate inputs at the boundary and reject malformed dates with a clear error instead of passing null down."],"exampleFix":"// before\nquery.planItemInstanceLastUnavailableBefore(end); // end may be null\n// after\nif (end != null) {\n    query.planItemInstanceLastUnavailableBefore(end);\n}","handlingStrategy":"validation","validationCode":"if (unavailableBefore != null) {\n    planItemInstanceQuery.planItemInstanceLastUnavailableBefore(unavailableBefore);\n}","typeGuard":"boolean isPresent(Date d) {\n    return d != null;\n}","tryCatchPattern":"try {\n    query.planItemInstanceLastUnavailableBefore(unavailableBefore);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"unavailableBefore is null\")) {\n        // omit the filter or reject the input\n    } else {\n        throw e;\n    }\n}","preventionTips":["Null-check all date bounds before applying them to the query","Centralize date parsing so null results cannot reach query builders","Prefer java.time with explicit error handling over lenient legacy parsers"],"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"}