{"record":{"id":"bb28815658a9eb0f","repo":"flowable/flowable-engine","slug":"there-are-no-process-instance-ids-to-delete","errorCode":null,"errorMessage":"There are no process instance ids to delete","messagePattern":"There are no process instance ids to delete","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsJobHandler.java","lineNumber":85,"sourceCode":"\n        ManagementService managementService = engineConfiguration.getManagementService();\n\n        BatchPart computeBatchPart = managementService.createBatchPartQuery()\n                .id(batchPart.getSearchKey())\n                .singleResult();\n\n        JsonNode computeBatchPartResult = getBatchPartResult(computeBatchPart, engineConfiguration);\n        JsonNode idsToDelete = computeBatchPartResult.path(\"processInstanceIdsToDelete\");\n        Set<String> processInstanceIdsToDelete = new HashSet<>();\n\n        if (idsToDelete.isArray()) {\n            for (JsonNode idNode : idsToDelete) {\n                processInstanceIdsToDelete.add(idNode.stringValue());\n            }\n        }\n\n        if (processInstanceIdsToDelete.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"There are no process instance ids to delete\");\n        }\n        \n        String status = DeleteProcessInstanceBatchConstants.STATUS_COMPLETED;\n        ObjectNode resultNode = engineConfiguration.getObjectMapper().createObjectNode();\n\n        HistoryService historyService = engineConfiguration.getHistoryService();\n        \n        try {\n            historyService.bulkDeleteHistoricProcessInstances(processInstanceIdsToDelete);\n            resultNode.withArray(\"processInstanceIdsDeleted\")\n                .addAll((ArrayNode) idsToDelete);\n            \n        } catch (FlowableException ex) {\n            status = DeleteProcessInstanceBatchConstants.STATUS_FAILED;\n            resultNode.withArray(\"processInstanceIdsFailedToDelete\")\n                    .addObject()\n                    .put(\"id\", processInstanceIdsToDelete.iterator().next())\n                    .put(\"error\", ex.getMessage())","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsJobHandler.java#L67-L103","documentation":"In DeleteHistoricProcessInstanceIdsJobHandler.execute, after parsing the idsToDelete JSON array from the job configuration, if the resulting list is empty the handler throws FlowableIllegalArgumentException. A batch part job was created without any process instance ids to delete, which makes the job meaningless — the library refuses to run it.","triggerScenarios":"The batch part's configuration JSON has no 'idsToDelete' node, or the array parses to zero entries, when the batch part job executes (DeleteHistoricProcessInstanceIdsJobHandler.java:85).","commonSituations":"Starting a historic process instance batch delete with a query matching zero instances combined with batchSize splitting; custom batch part creation passing an empty id list; JSON configuration corruption.","solutions":["Check that the historic process instance query returns at least one instance before starting the batch delete.","Skip creating batch parts when the id list is empty instead of submitting an empty part.","Validate/correct the job configuration JSON so idsToDelete contains at least one id."],"exampleFix":"// before\nhistoryService.createHistoricProcessInstanceQuery().finishedBefore(veryRecentDate) // matches nothing\n// after\nlong count = historyService.createHistoricProcessInstanceQuery().finishedBefore(date).count();\nif (count > 0) {\n    // start batch delete\n}","handlingStrategy":"validation","validationCode":"long count = historyService.createHistoricProcessInstanceQuery()\n    .finishedBefore(cutoffDate).count();\nif (count == 0) {\n    throw new IllegalArgumentException(\"No historic process instances match; skipping batch delete\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    // start/complete batch part\n} catch (FlowableIllegalArgumentException e) {\n    if (\"There are no process instance ids to delete\".equals(e.getMessage())) {\n        // treat as no-op completion\n    } else {\n        throw e;\n    }\n}","preventionTips":["Count matching historic instances before starting a batch delete.","Never create batch parts with an empty idsToDelete array."],"tags":["empty-list","batch","validation","flowable"],"backgroundTag":"empty-required-field","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"}