{"record":{"id":"6f2026eb334fde62","repo":"flowable/flowable-engine","slug":"processinstanceids-are-null","errorCode":null,"errorMessage":"processInstanceIds are null","messagePattern":"processInstanceIds are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteProcessInstancesByIdCmd.java","lineNumber":41,"sourceCode":"\n/**\n * @author Christopher Welsch\n */\npublic class DeleteProcessInstancesByIdCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected Collection<String> processInstanceIds;\n    protected String deleteReason;\n\n    public DeleteProcessInstancesByIdCmd(Collection<String> processInstanceIds, String deleteReason) {\n        this.processInstanceIds = processInstanceIds;\n        this.deleteReason = deleteReason;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (processInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"processInstanceIds are null\");\n        }\n\n        Set<String> processInstanceIdSet = new HashSet<>(processInstanceIds);\n        for (String processInstanceId : processInstanceIdSet) {\n            executeSingleDelete(commandContext, processInstanceId);\n        }\n        return null;\n    }\n\n    protected Void executeSingleDelete(CommandContext commandContext, String processInstanceId) {\n        DeleteProcessInstanceCmd command = new DeleteProcessInstanceCmd(processInstanceId, deleteReason);\n        return command.execute(commandContext);\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":56,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteProcessInstancesByIdCmd.java#L23-L56","documentation":"DeleteProcessInstancesByIdCmd validates that the collection of process instance ids is non-null before iterating and throwing FlowableIllegalArgumentException. Null collections are rejected outright; an empty collection simply deletes nothing.","triggerScenarios":"Calling runtimeService.deleteProcessInstances(ids, reason) with a null List/Set, typically from an unpopulated query result or a missing method argument.","commonSituations":"Bulk-cancel endpoints where the caller sent no ids and the server code forwards the raw (null) list; ids collected in a loop that never executed; deserialization of JSON with a missing ids field yielding null.","solutions":["Initialize the ids collection, e.g. new ArrayList<>() instead of null.","Guard the call site: if (ids == null) ids = Collections.emptyList();","Validate the request payload before mapping into the service call.","Consider checking isEmpty() too, since an empty collection is a no-op that may indicate a bug upstream."],"exampleFix":"// before\nruntimeService.deleteProcessInstances(processInstanceIds, \"bulk cancel\");\n// after\nif (processInstanceIds == null) {\n    processInstanceIds = Collections.emptyList();\n}\nruntimeService.deleteProcessInstances(processInstanceIds, \"bulk cancel\");","handlingStrategy":"validation","validationCode":"if (processInstanceIds == null) processInstanceIds = Collections.emptyList();","typeGuard":null,"tryCatchPattern":"try { rs.deleteProcessInstances(ids, reason); } catch (FlowableIllegalArgumentException e) { log.warn(\"No ids provided\", e); }","preventionTips":["Initialize collections, never leave them null","Validate bulk-delete payloads for the ids field","Treat empty input explicitly rather than relying on the engine"],"tags":["workflow","null-argument","bulk-delete","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"}