{"record":{"id":"d7a9d8e0df79b6ae","repo":"flowable/flowable-engine","slug":"failedbefore-is-null","errorCode":null,"errorMessage":"failedBefore is null","messagePattern":"failedBefore 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":597,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceTerminatedAfter(Date terminatedAfter) {\n        if (terminatedAfter == null) {\n            throw new FlowableIllegalArgumentException(\"terminatedAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.terminatedAfter = terminatedAfter;\n        } else {\n            this.terminatedAfter = terminatedAfter;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceFailedBefore(Date failedBefore) {\n        if (failedBefore == null) {\n            throw new FlowableIllegalArgumentException(\"failedBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.failedBefore = failedBefore;\n        } else {\n            this.failedBefore = failedBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceFailedAfter(Date failedAfter) {\n        if (failedAfter == null) {\n            throw new FlowableIllegalArgumentException(\"failedAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.failedAfter = failedAfter;\n        } else {\n            this.failedAfter = failedAfter;","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L579-L615","documentation":"Flowable throws FlowableIllegalArgumentException when planItemInstanceFailedBefore(Date) receives a null Date. This eager argument check ensures the query only ever contains usable timestamp criteria. Null means 'no filter', which the API expresses by not calling the method.","triggerScenarios":"Calling createPlanItemInstanceQuery().planItemInstanceFailedBefore(null), e.g. when the failed-before date originates from an optional client-supplied filter.","commonSituations":"Search form where 'failedBefore' was left blank; missing field after payload deserialization; date-parsing utility returning null for bad input.","solutions":["Supply a validated non-null Date.","Apply the criterion only when the value exists.","Reject empty or unparseable date strings before building the query.","Use try-catch on FlowableIllegalArgumentException to fail fast with a clear message."],"exampleFix":"// before\nquery.planItemInstanceFailedBefore(searchCriteria.getFailedBefore()); // may be null\n// after\nDate failedBefore = searchCriteria.getFailedBefore();\nif (failedBefore != null) {\n    query.planItemInstanceFailedBefore(failedBefore);\n}","handlingStrategy":"validation","validationCode":"if (failedBefore == null) {\n    throw new IllegalArgumentException(\"failedBefore must be non-null; omit the filter instead\");\n}\nquery.planItemInstanceFailedBefore(failedBefore);","typeGuard":"boolean hasFailedBefore = (failedBefore != null);","tryCatchPattern":"try {\n    query.planItemInstanceFailedBefore(failedBefore);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"failedBefore\")) {\n        throw new BadRequestException(\"failedBefore date filter must not be null\");\n    }\n    throw e;\n}","preventionTips":["Apply criteria only when the date value exists","Validate optional inputs at the API boundary before query building","Use Optional<Date> to make filter absence explicit","Test queries built with partially missing filters"],"tags":["java","flowable","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"}