{"record":{"id":"e707e2f193377f83","repo":"flowable/flowable-engine","slug":"parentscopeids-is-null-or-empty","errorCode":null,"errorMessage":"parentScopeIds is null or empty","messagePattern":"parentScopeIds is null or empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java","lineNumber":448,"sourceCode":"    }\n\n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceParentScopeId(String parentScopeId) {\n        if (parentScopeId == null) {\n            throw new FlowableIllegalArgumentException(\"parentScopeId is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.parentScopeId = parentScopeId;\n        } else {\n            this.parentScopeId = parentScopeId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricCaseInstanceQuery caseInstanceParentScopeIds(Set<String> parentScopeIds) {\n        if (parentScopeIds == null || parentScopeIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"parentScopeIds is null or empty\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.parentScopeIds = parentScopeIds;\n        } else {\n            this.parentScopeIds = parentScopeIds;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceBusinessStatus(String businessStatus) {\n        if (businessStatus == null) {\n            throw new FlowableIllegalArgumentException(\"Business status is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.businessStatus = businessStatus;\n        } else {\n            this.businessStatus = businessStatus;","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L430-L466","documentation":"HistoricCaseInstanceQueryImpl.caseInstanceParentScopeIds() validates its argument before storing it in the query state. Flowable throws FlowableIllegalArgumentException when the caller passes a null or empty Set of parent scope ids, because a null/empty set cannot be translated into a meaningful SQL IN clause and would silently return wrong results. The query is never built; the error is thrown immediately at call time, before executeList().","triggerScenarios":"Calling historicCaseInstanceQuery.caseInstanceParentScopeIds(null) or caseInstanceParentScopeIds(new HashSet<>()) (empty set). Also thrown inside an or() block via the currentOrQueryObject path since validation happens before the inOrStatement branch.","commonSituations":"Building query filters from dynamic data where the parent scope id collection comes from an optional configuration, a REST request parameter, or an upstream lookup that returned nothing; developers pass the result straight through without checking null/empty.","solutions":["Ensure the Set<String> passed to caseInstanceParentScopeIds contains at least one parent scope id before calling the query method.","If the collection is legitimately empty, skip calling caseInstanceParentScopeIds entirely so no parent-scope filter is applied.","If null means 'no filtering intended', guard the call: only invoke the setter when ids != null && !ids.isEmpty().","Catch FlowableIllegalArgumentException around query building if arguments are user-supplied, and return a 400-style validation error."],"exampleFix":"// before\nquery.caseInstanceParentScopeIds(parentIds);\n// after\nif (parentIds != null && !parentIds.isEmpty()) {\n    query.caseInstanceParentScopeIds(parentIds);\n}","handlingStrategy":"validation","validationCode":"if (parentScopeIds == null || parentScopeIds.isEmpty()) {\n    throw new IllegalArgumentException(\"parentScopeIds must contain at least one id\");\n}\nquery.caseInstanceParentScopeIds(parentScopeIds);","typeGuard":"boolean hasParentScopeIds(Set<String> ids) {\n    return ids != null && !ids.isEmpty();\n}","tryCatchPattern":"try {\n    query.caseInstanceParentScopeIds(parentScopeIds);\n} catch (FlowableIllegalArgumentException e) {\n    throw new InvalidRequestException(\"parentScopeIds: \" + e.getMessage());\n}","preventionTips":["Check null and isEmpty() before calling any collection-argument query setter","Skip optional filters instead of passing null/empty collections","Centralize query building in one helper that validates all filters","Unit-test query builders with absent/empty filter inputs"],"tags":["flowable","cmmn","query","null-argument","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}