{"record":{"id":"7db29b86b0d2e6a6","repo":"flowable/flowable-engine","slug":"task-name-list-is-empty","errorCode":null,"errorMessage":"Task name list is empty","messagePattern":"Task name list is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":742,"sourceCode":"    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskName(String taskName) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.taskName = taskName;\n        } else {\n            this.taskName = taskName;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskNameIn(Collection<String> taskNameList) {\n        if (taskNameList == null) {\n            throw new FlowableIllegalArgumentException(\"Task name list is null\");\n        }\n        if (taskNameList.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Task name list is empty\");\n        }\n\n        if (taskName != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and taskName\");\n        }\n        if (taskNameLike != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and taskNameLike\");\n        }\n        if (taskNameLikeIgnoreCase != null) {\n            throw new FlowableIllegalArgumentException(\"Invalid query usage: cannot set both taskNameIn and taskNameLikeIgnoreCase\");\n        }\n\n        if (inOrStatement) {\n            currentOrQueryObject.taskNameList = taskNameList;\n        } else {\n            this.taskNameList = taskNameList;\n        }\n        return this;","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L724-L760","documentation":"HistoricTaskInstanceQueryImpl.taskNameIn(Collection) throws FlowableIllegalArgumentException when the collection is non-null but empty. An empty IN list over task names would be invalid SQL or a no-op filter, so Flowable requires at least one name. Call the method only with a populated list.","triggerScenarios":"Calling historicTaskInstanceQuery().taskNameIn(new ArrayList<>()) or with a collection whose entries were all removed/filtered before query construction.","commonSituations":"Empty user selection in a UI passed straight to the query; configuration of included task names present but blank; deserialized empty JSON array.","solutions":["Skip the call when the list is empty: only invoke taskNameIn if !names.isEmpty().","Populate the collection with the intended task names before building the query.","Fall back to an unfiltered (or differently filtered) query when no names are available."],"exampleFix":"// before\nquery.taskNameIn(selectedNames); // empty\n// after\nif (selectedNames != null && !selectedNames.isEmpty()) {\n    query.taskNameIn(selectedNames);\n}","handlingStrategy":"validation","validationCode":"if (taskNameList != null && taskNameList.isEmpty()) {\n    // skip taskNameIn or fall back to another filter\n}","typeGuard":"boolean hasNames(Collection<String> names) {\n    return names != null && !names.isEmpty();\n}","tryCatchPattern":"try {\n    query.taskNameIn(names);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"Empty task name list: {}\", e.getMessage());\n}","preventionTips":["Validate UI/REST selections for at least one entry before applying taskNameIn.","Use isEmpty() checks on deserialized lists before passing them to Flowable.","Provide a sensible default filter when the name list is blank."],"tags":["flowable","query-builder","empty-collection","argument-validation"],"backgroundTag":"empty-required-field","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"}