{"record":{"id":"4867a47674f1dd68","repo":"flowable/flowable-engine","slug":"set-of-process-instance-ids-is-null-4867a4","errorCode":null,"errorMessage":"Set of process instance ids is null","messagePattern":"Set of process instance ids is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java","lineNumber":112,"sourceCode":"    }\n\n    @Override\n    public ProcessInstanceQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new ActivitiIllegalArgumentException(\"Process instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.executionId = processInstanceId;\n        } else {\n            this.executionId = processInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processInstanceIds(Set<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new ActivitiIllegalArgumentException(\"Set of process instance ids is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Set of process instance ids is empty\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceIds = processInstanceIds;\n        } else {\n            this.processInstanceIds = processInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processInstanceBusinessKey(String businessKey) {\n        if (businessKey == null) {\n            throw new ActivitiIllegalArgumentException(\"Business key is null\");\n        }","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java#L94-L130","documentation":"processInstanceIds(Set) filters by an explicit set of process instance ids. It throws ActivitiIllegalArgumentException('Set of process instance ids is null') when the set itself is null; emptiness is checked separately by the next guard.","triggerScenarios":"Calling ProcessInstanceQuery.processInstanceIds(null), commonly when a caller-supplied id list was mapped to a Set that stayed null (e.g. empty request body, null-split of a CSV parameter).","commonSituations":"Batch dashboards built from user-supplied id lists; integration code where the id collection failed to load before the query was issued.","solutions":["Pass a non-null, non-empty Set<String> of process instance ids","Initialize the set with an empty default at construction and check isEmpty() before querying","Skip the query entirely when no ids were supplied and return an empty result to the caller","Catch ActivitiIllegalArgumentException as an input-validation failure"],"exampleFix":"// before\nquery.processInstanceIds(requestedIds == null ? null : new HashSet<>(requestedIds));\n// after\nif (requestedIds != null && !requestedIds.isEmpty()) {\n    query.processInstanceIds(new HashSet<>(requestedIds));\n}","handlingStrategy":"validation","validationCode":"if (ids == null) {\n    throw new IllegalArgumentException(\"processInstanceIds set must not be null\");\n}\nif (ids.isEmpty()) {\n    return Collections.emptyList();\n}\nquery.processInstanceIds(new HashSet<>(ids));","typeGuard":"boolean isNonEmptySet(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.processInstanceIds(ids);\n} catch (ActivitiIllegalArgumentException e) {\n    throw new BadRequestException(\"A non-empty set of process instance ids is required\");\n}","preventionTips":["Initialize id collections with empty defaults, never null","Early-return empty results for empty inputs instead of querying","Deduplicate and normalize ids before building the set"],"tags":["java","activiti","query","null-argument","process-instance"],"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"}