{"record":{"id":"35e22e0929d271cd","repo":"flowable/flowable-engine","slug":"parentscopeids-is-null-or-empty-35e22e","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-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java","lineNumber":401,"sourceCode":"            this.rootScopeIds = rootScopeIds;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery processInstanceParentScopeId(String parentId) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.parentScopeId = parentId;\n        } else {\n            this.parentScopeId = parentId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricProcessInstanceQuery processInstanceParentScopeIds(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 HistoricProcessInstanceQuery deploymentId(String deploymentId) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.deploymentId = deploymentId;\n        } else {\n            this.deploymentId = deploymentId;\n        }\n        return this;\n    }","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricProcessInstanceQueryImpl.java#L383-L419","documentation":"HistoricProcessInstanceQuery.processInstanceParentScopeIds(Set<String>) requires a non-null, non-empty set of parent scope ids. Flowable throws FlowableIllegalArgumentException when parentScopeIds is null or empty, since an empty IN filter is meaningless. The check runs eagerly at query-build time.","triggerScenarios":"Calling processInstanceParentScopeIds(parentScopeIds) with a null reference or an empty set (e.g. new HashSet<>() or a collection emptied by upstream filtering).","commonSituations":"Queries on child process instances/scope hierarchy where the parent scope ids come from a nullable API parameter or from resolving a parent instance that returned none.","solutions":["Populate the set with at least one parent scope id before calling","Guard with null/isEmpty check and omit the criterion or take an alternate query path when absent","Return an empty result early if no parent scopes apply","Confirm the parent-instance lookup used to derive the ids is correct"],"exampleFix":"// before\nquery.processInstanceParentScopeIds(parentScopeIds); // throws when null or empty\n// after\nif (parentScopeIds != null && !parentScopeIds.isEmpty()) {\n    query.processInstanceParentScopeIds(parentScopeIds);\n}","handlingStrategy":"validation","validationCode":"if (parentScopeIds == null || parentScopeIds.isEmpty()) {\n    throw new IllegalArgumentException(\"parentScopeIds must be non-null and non-empty\");\n}\nquery.processInstanceParentScopeIds(parentScopeIds);","typeGuard":"boolean isValidScopeIds(Set<String> ids) {\n    return ids != null && !ids.isEmpty();\n}","tryCatchPattern":"try {\n    query.processInstanceParentScopeIds(parentScopeIds);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Skipping parent scope filter: {}\", e.getMessage());\n    // continue with query minus this criterion\n}","preventionTips":["Validate scope-id sets before query construction","Return empty collections, never null, from parent-resolution code","Short-circuit queries that depend on parent scope ids when none are available","Cover hierarchy queries with null/empty argument tests"],"tags":["flowable","null-check","empty-collection","query-validation"],"backgroundTag":"missing-required-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"}