{"record":{"id":"3ecca1354649e04a","repo":"flowable/flowable-engine","slug":"after-time-is-null-3ecca1","errorCode":null,"errorMessage":"after time is null","messagePattern":"after time is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java","lineNumber":950,"sourceCode":"    @Override\n    public ExecutionQuery startedBefore(Date beforeTime) {\n        if (beforeTime == null) {\n            throw new FlowableIllegalArgumentException(\"before time is null\");\n        }\n        \n        if (inOrStatement) {\n            currentOrQueryObject.startedBefore = beforeTime;\n        } else {\n            this.startedBefore = beforeTime;\n        }\n        \n        return this;\n    }\n\n    @Override\n    public ExecutionQuery startedAfter(Date afterTime) {\n        if (afterTime == null) {\n            throw new FlowableIllegalArgumentException(\"after time is null\");\n        }\n        \n        if (inOrStatement) {\n            currentOrQueryObject.startedAfter = afterTime;\n        } else {\n            this.startedAfter = afterTime;\n        }\n\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery startedBy(String userId) {\n        if (userId == null) {\n            throw new FlowableIllegalArgumentException(\"user id is null\");\n        }\n        \n        if (inOrStatement) {","sourceCodeStart":932,"sourceCodeEnd":968,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java#L932-L968","documentation":"ExecutionQueryImpl.startedAfter(Date) requires a non-null Date to filter process instances started after a given time. Flowable validates query parameters eagerly when building the query rather than at execution time, throwing FlowableIllegalArgumentException when null is passed. This prevents building a query with an undefined time criterion.","triggerScenarios":"Calling executionQuery.startedAfter(null) directly, or passing a Date variable that resolves to null (e.g. an uninitialized field, a missing map entry, or a method that returned null) into startedAfter while constructing an ExecutionQuery.","commonSituations":"Developers build dynamic date filters where the 'after' bound is optional; a null Optional-unwrapped date or a missing config value flows into startedAfter. Also common in code migrated from other APIs where null meant 'no filter'.","solutions":["Guard the call: only invoke startedAfter(date) if date != null, otherwise skip the filter entirely","Initialize the Date variable with a concrete value (e.g. new Date(0) for epoch) if a filter is always required","Use the flowable query without the time criterion and filter results in application code if null was intended to mean 'no bound'"],"exampleFix":"// before\nDate since = params.get(\"since\");\nruntimeService.createExecutionQuery().startedAfter(since);\n\n// after\nDate since = params.get(\"since\");\nExecutionQuery query = runtimeService.createExecutionQuery();\nif (since != null) {\n    query.startedAfter(since);\n}","handlingStrategy":"validation","validationCode":"if (afterTime != null) {\n    query.startedAfter(afterTime);\n}","typeGuard":"boolean hasAfterTime(Date d) { return d != null; }","tryCatchPattern":"try {\n    query.startedAfter(afterTime);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"after time is null\")) throw e;\n    // rebuild query without the time filter\n}","preventionTips":["Wrap optional query criteria in null-checked builder helpers","Never rely on null meaning 'no filter' in Flowable query APIs","Validate optional date parameters at the entry point of your service"],"tags":["flowable","query","null-argument","java"],"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"}