{"record":{"id":"ea9042bfa4bc2b93","repo":"flowable/flowable-engine","slug":"startedafter-is-null","errorCode":null,"errorMessage":"startedAfter is null","messagePattern":"startedAfter 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":480,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastStartedBefore(Date startedBefore) {\n        if (startedBefore == null) {\n            throw new FlowableIllegalArgumentException(\"activatedBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastStartedBefore = startedBefore;\n        } else {\n            this.lastStartedBefore = startedBefore;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastStartedAfter(Date startedAfter) {\n        if (startedAfter == null) {\n            throw new FlowableIllegalArgumentException(\"startedAfter is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastStartedAfter = startedAfter;\n        } else {\n            this.lastStartedAfter = startedAfter;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery planItemInstanceLastSuspendedBefore(Date suspendedBefore) {\n        if (suspendedBefore == null) {\n            throw new FlowableIllegalArgumentException(\"suspendedBefore is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.lastSuspendedBefore = suspendedBefore;\n        } else {\n            this.lastSuspendedBefore = suspendedBefore;","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L462-L498","documentation":"planItemInstanceLastStartedAfter(Date) throws FlowableIllegalArgumentException 'startedAfter is null' when the argument is null. Like all date filters in PlanItemInstanceQueryImpl, null is rejected eagerly in the builder because it cannot produce a valid SQL bound. The filter must be a concrete Date or simply not applied.","triggerScenarios":"Calling planItemInstanceLastStartedAfter(null), e.g. when a report period's start bound was never computed or a request field was omitted.","commonSituations":"Time-range report builders with optional bounds; null from date-range parsing of user input; microservice payloads missing the field; tests invoking builders with null to verify validation.","solutions":["Supply a valid Date instance.","Apply the filter conditionally only when the value is non-null.","Default the value at the API boundary before query construction.","Catch FlowableIllegalArgumentException and fall back to a query without the filter."],"exampleFix":"// before\nquery.planItemInstanceLastStartedAfter(range.getStart()); // may be null\n// after\nif (range.getStart() != null) {\n    query.planItemInstanceLastStartedAfter(range.getStart());\n}","handlingStrategy":"validation","validationCode":"if (startedAfter == null) {\n    throw new IllegalArgumentException(\"startedAfter must be a non-null Date\");\n}\nquery.planItemInstanceLastStartedAfter(startedAfter);","typeGuard":"boolean boundPresent(Date d) { return d != null; }","tryCatchPattern":"try {\n    query.planItemInstanceLastStartedAfter(startedAfter);\n} catch (FlowableIllegalArgumentException e) {\n    query = cmmnRuntimeService.createPlanItemInstanceQuery();\n}","preventionTips":["Null-check date range bounds before query construction","Skip absent bounds rather than passing null","Compute report period bounds defensively","Include null-filter cases in test suites"],"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"}