{"record":{"id":"3760717b35216e1e","repo":"flowable/flowable-engine","slug":"enabledbefore-is-null","errorCode":null,"errorMessage":"enabledBefore is null","messagePattern":"enabledBefore 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":415,"sourceCode":"    }\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;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastEnabledBefore(Date enabledBefore) {\n        if (enabledBefore == null) {\n            throw new FlowableIllegalArgumentException(\"enabledBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastEnabledBefore = enabledBefore;\n        } else {\n            this.lastEnabledBefore = enabledBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastEnabledAfter(Date enabledAfter) {\n        if (enabledAfter == null) {\n            throw new FlowableIllegalArgumentException(\"enabledAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastEnabledAfter = enabledAfter;\n        } else {\n            this.lastEnabledAfter = enabledAfter;","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L397-L433","documentation":"planItemInstanceLastEnabledBefore(Date) validates that enabledBefore is non-null and throws FlowableIllegalArgumentException otherwise. Like all Flowable CMMN query filters, the check happens in the builder method so bad queries fail fast at construction. A null Date cannot be translated into a SQL comparison, so it is rejected.","triggerScenarios":"Calling createPlanItemInstanceQuery().planItemInstanceLastEnabledBefore(null), usually from an unassigned Date field, an absent request parameter, or a mapping layer that produced null.","commonSituations":"Dashboard/search forms where the 'enabledBefore' filter is optional and the null value is forwarded unchanged; deserialization of JSON payloads missing the date field; unit tests passing null to check behavior.","solutions":["Pass a valid Date, e.g. planItemInstanceLastEnabledBefore(someParsedDate).","Guard the call: only invoke the method when the date is non-null.","Normalize optional input with Optional.ofNullable(...).orElse(default) before building the query.","Wrap in try-catch for FlowableIllegalArgumentException and build the query without the filter."],"exampleFix":"// before\nquery.planItemInstanceLastEnabledBefore(null);\n// after\nDate enabledBefore = parseDate(request.getEnabledBefore());\nif (enabledBefore != null) {\n    query.planItemInstanceLastEnabledBefore(enabledBefore);\n}","handlingStrategy":"validation","validationCode":"if (enabledBefore == null) {\n    throw new IllegalArgumentException(\"enabledBefore must be non-null\");\n}\nquery.planItemInstanceLastEnabledBefore(enabledBefore);","typeGuard":"boolean isUsableDate(Date d) { return d != null; }","tryCatchPattern":"try {\n    query.planItemInstanceLastEnabledBefore(enabledBefore);\n} catch (FlowableIllegalArgumentException e) {\n    query = cmmnRuntimeService.createPlanItemInstanceQuery();\n}","preventionTips":["Validate optional filter inputs before constructing the query","Skip filters that have no value instead of passing null","Keep DTO-to-query mapping code null-aware","Test all query builder calls with missing filter values"],"tags":["java","flowable","cmmn","query","null-argument"],"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"}