{"record":{"id":"3cb3843fe55bf5d5","repo":"flowable/flowable-engine","slug":"task-ids-are-null","errorCode":null,"errorMessage":"Task ids are null","messagePattern":"Task ids are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":226,"sourceCode":"\n    @Override\n    public TaskQueryImpl taskId(String taskId) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"Task id is null\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.taskId = taskId;\n        } else {\n            this.taskId = taskId;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery taskIds(Collection<String> taskIds) {\n        if (taskIds == null) {\n            throw new FlowableIllegalArgumentException(\"Task ids are null\");\n        }\n        if (orActive) {\n            currentOrQueryObject.taskIds = taskIds;\n        } else {\n            this.taskIds = taskIds;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl taskName(String name) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"Task name is null\");\n        }\n\n        if (orActive) {\n            currentOrQueryObject.name = name;\n        } else {","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L208-L244","documentation":"Flowable throws this FlowableIllegalArgumentException when TaskQuery.taskIds(null) is called. The batch task-id filter requires a non-null collection to build the SQL IN clause. The rejection is immediate at query-construction time.","triggerScenarios":"Calling taskService.createTaskQuery().taskIds(null), commonly when the collection comes from a method parameter, stream result, or optional field that was null.","commonSituations":"Batch endpoints where the caller supplied no ids and the null collection was forwarded; helper methods assembling task queries from optional id lists.","solutions":["Pass Collections.emptyList() instead of null if there are no ids, and skip the filter for empty lists.","Null-check the collection before calling taskIds and either omit the filter or throw your own descriptive error.","Ensure the upstream code producing the collection always initializes it (e.g. Stream.collect(Collectors.toList()) never returns null).","Validate request payloads so an absent id list is rejected at the boundary."],"exampleFix":"// before\nquery.taskIds(request.getTaskIds()); // throws when null\n// after\nList<String> ids = request.getTaskIds();\nif (ids != null && !ids.isEmpty()) {\n    query.taskIds(ids);\n}","handlingStrategy":"validation","validationCode":"if (taskIds == null) { taskIds = Collections.emptyList(); }\nif (!taskIds.isEmpty()) {\n    query.taskIds(taskIds);\n}","typeGuard":"boolean isNonEmpty(Collection<?> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    query.taskIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().equals(\"Task ids are null\")) {\n        log.warn(\"taskIds was null; applying query without id filter\");\n        query = taskService.createTaskQuery();\n    } else { throw e; }\n}","preventionTips":["Initialize id collections to empty lists at their source","Skip batch filters for null/empty collections","Use Optional<List<String>> or explicit empty-list semantics in APIs","Null-check inputs at the service boundary with descriptive errors"],"tags":["flowable","query-builder","null-argument","collection"],"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"}