flowable/flowable-engine · error · FlowableIllegalArgumentException

There is no batch part with the id ${batchPartId}

Error message

There is no batch part with the id ${batchPartId}

What it means

Thrown by BatchDeleteCaseConfig.create() when the batchService cannot find a BatchPart entity for the given batchPartId. The batch part is looked up to reconstruct the delete-case batch configuration; without it, deletion progress cannot be resumed. It is an argument-validation error on an identifier passed to the API.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/BatchDeleteCaseConfig.java:89

    }

    public boolean isSequentialExecution() {
        return sequentialExecution;
    }

    public int getBatchSize() {
        return batchSize;
    }

    public HistoricCaseInstanceQuery getQuery() {
        return query;
    }

    public static BatchDeleteCaseConfig create(String batchPartId, CmmnEngineConfiguration engineConfiguration) {
        BatchService batchService = engineConfiguration.getBatchServiceConfiguration().getBatchService();
        BatchPart batchPart = batchService.getBatchPart(batchPartId);
        if (batchPart == null) {
            throw new FlowableIllegalArgumentException("There is no batch part with the id " + batchPartId);
        }

        Batch batch = batchService.getBatch(batchPart.getBatchId());
        JsonNode batchConfiguration = getBatchConfiguration(batch, engineConfiguration);
        boolean sequentialExecution = batchConfiguration.path("sequential").booleanValue(false);

        JsonNode queryNode = batchConfiguration.path("query");
        if (queryNode.isMissingNode()) {
            return new BatchDeleteCaseConfig(batch, batchPart,
                    prepareFailedResultAsJsonString("Batch configuration has no query definition", engineConfiguration), sequentialExecution);
        }

        JsonNode batchSizeNode = batchConfiguration.path("batchSize");
        if (batchSizeNode.isMissingNode()) {
            return new BatchDeleteCaseConfig(batch, batchPart, prepareFailedResultAsJsonString("Batch configuration has no batch size", engineConfiguration),
                    sequentialExecution);
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the batchPartId against the ACT_RU_BATCH_PART table (or BatchService.createBatchPartQuery()) before calling create()
  2. Confirm you are passing the BatchPart id, not the parent Batch id
  3. Check you are connected to the same database/engine where the batch was created
  4. If the batch already finished, skip deletion of historic case instances instead of resuming

Example fix

// before
BatchDeleteCaseConfig.create(batchPartId, engineConfig); // throws if null
// after
BatchPart part = engineConfig.getBatchServiceConfiguration().getBatchService().getBatchPart(batchPartId);
if (part != null) {
    BatchDeleteCaseConfig.create(batchPartId, engineConfig);
}
Defensive patterns

Strategy: validation

Validate before calling

if (batchService.getBatchPart(batchPartId) == null) {
    throw new IllegalStateException("Unknown batchPartId: " + batchPartId);
}
BatchDeleteCaseConfig.create(batchPartId, engineConfiguration);

Type guard

boolean batchPartExists(String id, BatchService s) { return id != null && s.getBatchPart(id) != null; }

Prevention

When it happens

Trigger: Calling BatchDeleteCaseConfig.create(batchPartId, engineConfiguration) with a batchPartId that does not exist, was already completed and purged, or belongs to a different engine/database.

Common situations: Stale batch part ids stored between restarts; passing a Batch id instead of a BatchPart id; typo in id; running against a clean database after a data purge.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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