{"record":{"id":"6dbe2bead1b52ae6","repo":"flowable/flowable-engine","slug":"set-of-called-process-instance-ids-is-empty","errorCode":null,"errorMessage":"Set of called process instance ids is empty","messagePattern":"Set of called process instance ids is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java","lineNumber":166,"sourceCode":"    @Override\n    public HistoricActivityInstanceQueryImpl finishedBefore(Date date) {\n        this.finishedBefore = date;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQuery activityTypes(Set<String> activityTypes) {\n        this.activityTypes=activityTypes;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQuery calledProcessInstanceIds(Set<String> calledProcessInstanceIds) {\n        if (calledProcessInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of called process instance ids is null\");\n        }\n        if (calledProcessInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of called process instance ids is empty\");\n        }\n        this.calledProcessInstanceIds = calledProcessInstanceIds;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl taskAssignee(String assignee) {\n        this.assignee = assignee;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQuery taskCompletedBy(String userId) {\n        this.completedBy = userId;\n        return this;\n    }\n\n    @Override","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java#L148-L184","documentation":"HistoricActivityInstanceQueryImpl.calledProcessInstanceIds(Set<String>) rejects an empty set with FlowableIllegalArgumentException. An empty id set cannot form a valid SQL IN clause, so Flowable validates it eagerly at query construction.","triggerScenarios":"Calling calledProcessInstanceIds with an empty HashSet, or with a set whose elements were all removed/filtered out before building the query.","commonSituations":"Call-activity analysis where no sub-process instances exist yet; filters narrowed to zero matches by user selections.","solutions":["Check isEmpty() before applying the filter; skip it or return an empty result early","Collect sub-process ids with a fallback default of Collections.emptySet() and branch on emptiness","If the analysis is meaningless with no sub-processes, avoid the query and communicate 'no data' to the caller"],"exampleFix":"// before\nquery.calledProcessInstanceIds(collectCalledIds());\n\n// after\nSet<String> calledIds = collectCalledIds();\nif (!calledIds.isEmpty()) {\n    query.calledProcessInstanceIds(calledIds);\n} else {\n    return Collections.emptyList();\n}","handlingStrategy":"validation","validationCode":"if (calledIds != null && !calledIds.isEmpty()) {\n    query.calledProcessInstanceIds(calledIds);\n} else {\n    return Collections.emptyList();\n}","typeGuard":"boolean isNonEmptySet(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.calledProcessInstanceIds(calledIds);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"called process instance ids is empty\")) throw e;\n    // treat as no data\n}","preventionTips":["Treat empty id sets as 'no data expected' and skip the query","Validate collection filters (null and empty) in a shared query-builder utility"],"tags":["flowable","query","empty-collection","history","java"],"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-14T11:17:12.474Z"}