flowable/flowable-engine · error · FlowableIllegalArgumentException
There are no case instance ids to delete
Error message
There are no case instance ids to delete
What it means
Thrown by DeleteHistoricCaseInstanceIdsJobHandler.execute() when the ids-to-delete list parsed from the batch part configuration is empty. An empty deletion batch is treated as invalid because there is nothing to do and the batch completion logic expects at least one id.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/DeleteHistoricCaseInstanceIdsJobHandler.java:86
CmmnManagementService managementService = engineConfiguration.getCmmnManagementService();
BatchPart computeBatchPart = managementService.createBatchPartQuery()
.id(batchPart.getSearchKey())
.singleResult();
JsonNode computeBatchPartResult = getBatchPartResult(computeBatchPart, engineConfiguration);
JsonNode idsToDelete = computeBatchPartResult.path("caseInstanceIdsToDelete");
Set<String> caseInstanceIdsToDelete = new HashSet<>();
if (idsToDelete.isArray()) {
for (JsonNode idNode : idsToDelete) {
caseInstanceIdsToDelete.add(idNode.stringValue());
}
}
if (caseInstanceIdsToDelete.isEmpty()) {
throw new FlowableIllegalArgumentException("There are no case instance ids to delete");
}
String status = DeleteCaseInstanceBatchConstants.STATUS_COMPLETED;
ObjectNode resultNode = engineConfiguration.getObjectMapper().createObjectNode();
CmmnHistoryService historyService = engineConfiguration.getCmmnHistoryService();
try {
historyService.bulkDeleteHistoricCaseInstances(caseInstanceIdsToDelete);
resultNode.withArray("caseInstanceIdsDeleted")
.addAll((ArrayNode) idsToDelete);
} catch (FlowableException ex) {
status = DeleteCaseInstanceBatchConstants.STATUS_FAILED;
resultNode.withArray("caseInstanceIdsFailedToDelete")
.addObject()
.put("id", caseInstanceIdsToDelete.iterator().next())
.put("error", ex.getMessage())View on GitHub (pinned to d6d39ce1c6)
Solutions
- Ensure the HistoricCaseInstanceQuery used to build the batch matches at least one case instance before creating the batch
- Check the batch configuration JSON contains a non-empty idsToDelete array
- Validate case ids exist in history (case instances were finished/archived) before batching
- Do not create a batch when the query count is 0; handle the no-op case in caller code
Example fix
// before
managementService.bulkDeleteHistoricCaseInstances(query, 10, true); // query matched 0
// after
if (query.count() > 0) {
managementService.bulkDeleteHistoricCaseInstances(query, 10, true);
} Defensive patterns
Strategy: validation
Validate before calling
long count = historicCaseInstanceQuery.count();
if (count == 0) throw new IllegalArgumentException("Query matches no case instances; nothing to delete");
managementService.bulkDeleteHistoricCaseInstances(historicCaseInstanceQuery, batchSize, sequential); Try / catch
try { createBatch(cmd); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains("no case instance ids to delete")) { log.warn("Empty delete batch skipped"); return null; } throw e; } Prevention
- Check query.count() > 0 before creating a delete batch
- Do not hand-edit idsToDelete in batch configuration JSON
- Confirm historic case instances exist (finished cases) before batching
When it happens
Trigger: The batch part's configuration JSON has an empty or missing 'idsToDelete' array, so after parsing, caseInstanceIdsToDelete.isEmpty() is true.
Common situations: Creating a delete batch with a query that matched zero case instances; corrupted or truncated batch configuration JSON; a bug where ids were consumed/removed before the job ran.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- There are no process instance ids to delete
- type is required when adding a new case instance identity li
- userId and groupId cannot both be null
- The case instance id is mandatory, but '
- caseInstanceId is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/ba9f73f8fc553a74.
Report an issue: GitHub.