flowable/flowable-engine · error · FlowableIllegalArgumentException

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

Error message

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

What it means

Thrown by DeleteHistoricCaseInstanceIdsJobHandler.execute() when the BatchService cannot find a BatchPart with the id stored in the job's configuration. The handler needs the batch part to report per-id deletion results back to the parent batch.

Source

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

 * @author Filip Hrisafov
 */
public class DeleteHistoricCaseInstanceIdsJobHandler implements JobHandler {

    public static final String TYPE = "delete-historic-case-ids";

    @Override
    public String getType() {
        return TYPE;
    }

    @Override
    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
        CmmnEngineConfiguration engineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        BatchService batchService = engineConfiguration.getBatchServiceConfiguration().getBatchService();

        BatchPart batchPart = batchService.getBatchPart(configuration);
        if (batchPart == null) {
            throw new FlowableIllegalArgumentException("There is no batch part with the id " + configuration);
        }

        Batch batch = batchService.getBatch(batchPart.getBatchId());
        if (DeleteCaseInstanceBatchConstants.STATUS_STOPPED.equals(batch.getStatus())) {
            batchService.completeBatchPart(batchPart.getId(), DeleteCaseInstanceBatchConstants.STATUS_STOPPED, null);
            return;
        }

        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<>();

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the job's configuration id exists in ACT_RU_BATCH_PART before executing
  2. Delete orphaned jobs whose batch parts no longer exist
  3. Check the engine is connected to the same database where the batch was created
  4. If the batch was stopped/completed, mark the job done instead of retrying

Example fix

// before
handler.execute(job, stalePartId, scope, ctx); // throws
// after
if (batchService.getBatchPart(partId) != null) {
    handler.execute(job, partId, scope, ctx);
} else {
    // remove orphaned job
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (batchService.getBatchPart(configuration) == null) {
    // skip/remove the orphaned job
    return;
}

Try / catch

try { jobHandler.execute(job, configuration, scope, ctx); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains("no batch part with the id")) { log.warn("Orphaned delete job for missing batch part {}", configuration, e); } else { throw e; } }

Prevention

When it happens

Trigger: A worker job for deleting historic case instance ids runs, but its configured batchPartId no longer exists in the BatchService (part completed and removed, deleted manually, or wrong database/engine).

Common situations: Orphaned async jobs after batch parts were purged; re-running jobs on a restored/cleaned database; environment mismatch between job and batch storage.

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/12ea16cd22c3b992. Report an issue: GitHub.