{"record":{"id":"359959e5076e86a4","repo":"flowable/flowable-engine","slug":"set-of-called-process-instance-ids-is-null","errorCode":null,"errorMessage":"Set of called process instance ids is null","messagePattern":"Set of called process instance ids is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java","lineNumber":163,"sourceCode":"        this.finishedAfter = date;\n        return this;\n    }\n    @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;","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java#L145-L181","documentation":"HistoricActivityInstanceQueryImpl.calledProcessInstanceIds(Set<String>) rejects a null set with FlowableIllegalArgumentException. This filter restricts activity instances to those of called (sub) process instances with the given ids. Null means the criterion is undefined, which Flowable does not accept.","triggerScenarios":"Calling query.calledProcessInstanceIds(null), or passing a set derived from an absent/optional collection of sub-process instance ids (uninitialized field, null map lookup).","commonSituations":"Analyzing call-activity hierarchies where the sub-process ids are collected from a previous query that returned null; optional drill-down filters in monitoring tools.","solutions":["Guard the call with a null check and skip the filter when the set is absent","Ensure the id collection step always returns an empty set rather than null","Use the singular calledProcessInstanceId(String) if only one id is known and it may be absent"],"exampleFix":"// before\nSet<String> calledIds = hierarchyLookup.getSubProcessIds();\nquery.calledProcessInstanceIds(calledIds);\n\n// after\nSet<String> calledIds = hierarchyLookup.getSubProcessIds();\nif (calledIds != null) {\n    query.calledProcessInstanceIds(calledIds);\n}","handlingStrategy":"validation","validationCode":"if (calledIds != null && !calledIds.isEmpty()) {\n    query.calledProcessInstanceIds(calledIds);\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 null\")) throw e;\n    // rebuild query without the called-ids filter\n}","preventionTips":["Make hierarchy/id lookups return empty sets instead of null","Null-check optional filter inputs before applying them to Flowable queries"],"tags":["flowable","query","null-argument","history","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-14T11:17:12.474Z"}