{"record":{"id":"d92f34cf5e95aef1","repo":"flowable/flowable-engine","slug":"occurredbefore-is-null","errorCode":null,"errorMessage":"occurredBefore is null","messagePattern":"occurredBefore 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":545,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceCompletedAfter(Date completedAfter) {\n        if (completedAfter == null) {\n            throw new FlowableIllegalArgumentException(\"completedAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.completedAfter = completedAfter;\n        } else {\n            this.completedAfter = completedAfter;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceOccurredBefore(Date occurredBefore) {\n        if (occurredBefore == null) {\n            throw new FlowableIllegalArgumentException(\"occurredBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.occurredBefore = occurredBefore;\n        } else {\n            this.occurredBefore = occurredBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceOccurredAfter(Date occurredAfter) {\n        if (occurredAfter == null) {\n            throw new FlowableIllegalArgumentException(\"occurredAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.occurredAfter = occurredAfter;\n        } else {\n            this.occurredAfter = occurredAfter;","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L527-L563","documentation":"Flowable throws FlowableIllegalArgumentException when planItemInstanceOccurredBefore(Date) receives a null Date. Query criteria methods validate arguments eagerly so invalid queries fail at build time instead of at SQL execution. A null filter value should be expressed by not calling the method at all.","triggerScenarios":"Calling createPlanItemInstanceQuery().planItemInstanceOccurredBefore(null), e.g. when the before-date originates from an optional client parameter or an unset DTO field.","commonSituations":"Web layer forwarding a missing 'occurredBefore' request parameter; deserialization leaving the field null; a failed date conversion returning null.","solutions":["Provide a concrete Date before calling planItemInstanceOccurredBefore.","Guard the call site with a null check and skip the method when the value is absent.","Parse string inputs explicitly and reject empty/invalid values before query construction.","Catch FlowableIllegalArgumentException around query building to surface a meaningful validation error."],"exampleFix":"// before\nquery.planItemInstanceOccurredBefore(input.getOccurredBefore()); // null when unset\n// after\nif (input.getOccurredBefore() != null) {\n    query.planItemInstanceOccurredBefore(input.getOccurredBefore());\n}","handlingStrategy":"validation","validationCode":"if (occurredBefore == null) {\n    throw new IllegalArgumentException(\"occurredBefore must be non-null; omit the filter instead\");\n}\nquery.planItemInstanceOccurredBefore(occurredBefore);","typeGuard":"boolean hasOccurredBefore = (occurredBefore != null);","tryCatchPattern":"try {\n    query.planItemInstanceOccurredBefore(occurredBefore);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"occurredBefore\")) {\n        throw new BadRequestException(\"occurredBefore date filter must not be null\");\n    }\n    throw e;\n}","preventionTips":["Apply query criteria only when the date value is present","Validate optional request parameters before query construction","Use a query-builder helper that skips null filters","Fail fast on empty date inputs at the API boundary"],"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"}