flowable/flowable-engine · error · FlowableIllegalArgumentException

There are no process instance ids to delete

Error message

There are no process instance ids to delete

What it means

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.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsJobHandler.java:85

        ManagementService managementService = engineConfiguration.getManagementService();

        BatchPart computeBatchPart = managementService.createBatchPartQuery()
                .id(batchPart.getSearchKey())
                .singleResult();

        JsonNode computeBatchPartResult = getBatchPartResult(computeBatchPart, engineConfiguration);
        JsonNode idsToDelete = computeBatchPartResult.path("processInstanceIdsToDelete");
        Set<String> processInstanceIdsToDelete = new HashSet<>();

        if (idsToDelete.isArray()) {
            for (JsonNode idNode : idsToDelete) {
                processInstanceIdsToDelete.add(idNode.stringValue());
            }
        }

        if (processInstanceIdsToDelete.isEmpty()) {
            throw new FlowableIllegalArgumentException("There are no process instance ids to delete");
        }
        
        String status = DeleteProcessInstanceBatchConstants.STATUS_COMPLETED;
        ObjectNode resultNode = engineConfiguration.getObjectMapper().createObjectNode();

        HistoryService historyService = engineConfiguration.getHistoryService();
        
        try {
            historyService.bulkDeleteHistoricProcessInstances(processInstanceIdsToDelete);
            resultNode.withArray("processInstanceIdsDeleted")
                .addAll((ArrayNode) idsToDelete);
            
        } catch (FlowableException ex) {
            status = DeleteProcessInstanceBatchConstants.STATUS_FAILED;
            resultNode.withArray("processInstanceIdsFailedToDelete")
                    .addObject()
                    .put("id", processInstanceIdsToDelete.iterator().next())
                    .put("error", ex.getMessage())

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check that the historic process instance query returns at least one instance before starting the batch delete.
  2. Skip creating batch parts when the id list is empty instead of submitting an empty part.
  3. Validate/correct the job configuration JSON so idsToDelete contains at least one id.

Example fix

// before
historyService.createHistoricProcessInstanceQuery().finishedBefore(veryRecentDate) // matches nothing
// after
long count = historyService.createHistoricProcessInstanceQuery().finishedBefore(date).count();
if (count > 0) {
    // start batch delete
}
Defensive patterns

Strategy: validation

Validate before calling

long count = historyService.createHistoricProcessInstanceQuery()
    .finishedBefore(cutoffDate).count();
if (count == 0) {
    throw new IllegalArgumentException("No historic process instances match; skipping batch delete");
}

Try / catch

try {
    // start/complete batch part
} catch (FlowableIllegalArgumentException e) {
    if ("There are no process instance ids to delete".equals(e.getMessage())) {
        // treat as no-op completion
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/bb28815658a9eb0f. Report an issue: GitHub.