flowable/flowable-engine · error · FlowableIllegalArgumentException

There is no batch with the id

Error message

There is no batch with the id ${configuration}

What it means

ComputeDeleteHistoricProcessInstanceStatusJobHandler.execute queries a Batch by the job's configuration id (via createBatchQuery().batchId(configuration)). If no batch exists with that id it throws FlowableIllegalArgumentException. This means a status-check repeat job is referencing a batch that no longer exists (deleted or purged).

Solutions

  1. Verify the batch id in the job's configuration still exists (select from ACT_RU_BATCH) before the job runs.
  2. Delete the orphaned job whose configuration references the missing batch.
  3. Use BatchService/ManagementService to cancel the batch properly instead of deleting rows directly.
  4. Re-trigger the historic process instance deletion to recreate the batch.

Example fix

// before
managementService.deleteBatch(batchId); // leaves orphan repeat jobs
// after
managementService.deleteBatch(batchId);
managementService.moveJobToDeadLetterJob(...) // or cancel associated repeat jobs first
Defensive patterns

Strategy: validation

Validate before calling

Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();
if (batch == null) {
    // batch is gone; cancel/skip the job instead of letting the handler throw
}

Try / catch

try {
    // trigger job execution
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().startsWith("There is no batch with the id")) {
        // delete or ignore the orphaned job
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A repeating delete-historic-process-instance status job fires with a configuration (batch id) that does not resolve to any batch in ACT_RU_BATCH — e.g. the batch row was deleted while its jobs remained.

Common situations: Manual deletion of batch rows from the runtime tables; batch cleanup/purge jobs removing a batch but leaving repeat timer jobs; restoring data from backups where batch rows were lost.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/ComputeDeleteHistoricProcessInstanceStatusJobHandler.java:56

public class ComputeDeleteHistoricProcessInstanceStatusJobHandler implements JobHandler {

    public static final String TYPE = "compute-delete-historic-process-status";

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

    @Override
    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
        ProcessEngineConfigurationImpl engineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        ManagementService managementService = engineConfiguration.getManagementService();
        Batch batch = managementService.createBatchQuery()
                .batchId(configuration)
                .singleResult();

        if (batch == null) {
            throw new FlowableIllegalArgumentException("There is no batch with the id " + configuration);
        }

        if (DeleteProcessInstanceBatchConstants.STATUS_STOPPED.equals(batch.getStatus())) {
            // The batch has been stopped there is nothing that we need to check anymore, so we will set the repeat to null
            job.setRepeat(null);
            return;
        }

        long totalBatchParts = createStatusQuery(batch, managementService).count();
        long totalCompleted = createStatusQuery(batch, managementService).completed().count();

        if (totalBatchParts == totalCompleted) {
            long totalFailed = createStatusQuery(batch, managementService)
                    .status(DeleteProcessInstanceBatchConstants.STATUS_FAILED)
                    .count();
            if (totalFailed == 0) {
                List<BatchPart> deleteBatchParts = managementService.createBatchPartQuery()
                        .batchId(batch.getId())

View on GitHub (pinned to d6d39ce1c6)