{"record":{"id":"6391432a4cb3162f","repo":"flowable/flowable-engine","slug":"set-of-process-instance-ids-is-null-639143","errorCode":null,"errorMessage":"Set of process instance ids is null","messagePattern":"Set of 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":95,"sourceCode":"    public long executeCount(CommandContext commandContext) {\n        return CommandContextUtil.getHistoricActivityInstanceEntityManager(commandContext).findHistoricActivityInstanceCountByQueryCriteria(this);\n    }\n\n    @Override\n    public List<HistoricActivityInstance> executeList(CommandContext commandContext) {\n        return CommandContextUtil.getHistoricActivityInstanceEntityManager(commandContext).findHistoricActivityInstancesByQueryCriteria(this);\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl processInstanceId(String processInstanceId) {\n        this.processInstanceId = processInstanceId;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl processInstanceIds(Set<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is empty\");\n        }\n        this.processInstanceIds = processInstanceIds;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl executionId(String executionId) {\n        this.executionId = executionId;\n        return this;\n    }\n\n    @Override\n    public HistoricActivityInstanceQueryImpl processDefinitionId(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n        return this;","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java#L77-L113","documentation":"HistoricActivityInstanceQueryImpl.processInstanceIds(Set<String>) rejects a null set with FlowableIllegalArgumentException. The query needs an explicit, non-empty set of process instance ids to restrict activity instances to. Omit the call instead of passing null when the filter is not needed.","triggerScenarios":"Calling historicActivityInstanceQuery.processInstanceIds(null), or passing a set built from a null/absent collection (e.g. a null list converted via new HashSet<>(nullList) throwing, or a field that was never populated).","commonSituations":"Reporting screens where the id list comes from an optional request parameter; code paths where an upstream query returned null instead of an empty collection.","solutions":["Guard: only call processInstanceIds(ids) when ids != null","Default the collection to Collections.emptySet() upstream, then skip applying the filter if empty","If ids is null because the source query failed, fix the source to return an empty collection"],"exampleFix":"// before\nSet<String> ids = getSelectedInstanceIds();\nquery.processInstanceIds(ids);\n\n// after\nSet<String> ids = getSelectedInstanceIds();\nif (ids != null && !ids.isEmpty()) {\n    query.processInstanceIds(ids);\n}","handlingStrategy":"validation","validationCode":"if (ids != null && !ids.isEmpty()) {\n    query.processInstanceIds(ids);\n}","typeGuard":"boolean isNonEmptySet(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.processInstanceIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"Set of process instance ids is null\")) throw e;\n    // rebuild query without the id filter\n}","preventionTips":["Initialize id collections to empty sets, never null","Check null and emptiness before applying collection-based filters"],"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"}