flowable/flowable-engine · error · FlowableIllegalArgumentException

There is no batch with the id ${configuration}

Error message

There is no batch with the id ${configuration}

What it means

Thrown by ComputeDeleteHistoricCaseInstanceStatusJobHandler.execute() when its periodic status-check job runs but the parent Batch (looked up via createBatchQuery().batchId(configuration)) no longer exists. The job's 'configuration' holds the batch id; without the batch, completion status cannot be computed.

Source

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

public class ComputeDeleteHistoricCaseInstanceStatusJobHandler implements JobHandler {

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

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

    @Override
    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {
        CmmnEngineConfiguration engineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        CmmnManagementService managementService = engineConfiguration.getCmmnManagementService();
        Batch batch = managementService.createBatchQuery()
                .batchId(configuration)
                .singleResult();

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

        if (DeleteCaseInstanceBatchConstants.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(DeleteCaseInstanceBatchConstants.STATUS_FAILED)
                    .count();

            if (totalFailed == 0) {
                List<BatchPart> deleteBatchParts = managementService.createBatchPartQuery()

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Cancel the repeat job (delete the job entity) when deleting the batch so no orphan status job remains
  2. Restore/verify the batch id in ACT_RU_BATCH matches the job configuration
  3. Check job configuration points to the correct engine/database
  4. Clear stale jobs after data purges

Example fix

// before
managementService.deleteBatch(batchId); // leaves status job behind
// after
managementService.deleteBatch(batchId);
managementService.deleteBulkIdJobs / cancel jobs with configuration=batchId; // cancel related jobs too
Defensive patterns

Strategy: try-catch

Validate before calling

Batch b = managementService.createBatchQuery().batchId(batchId).singleResult();
if (b == null) { // cancel the orphan repeat job instead of letting it run
    managementService.deleteJob(jobId); }

Try / catch

try { jobHandler.execute(job, configuration, scope, ctx); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains("no batch with the id")) { log.warn("Batch gone; removing orphan status job", e); managementService.deleteJob(job.getId()); } }

Prevention

When it happens

Trigger: The repeat job fires after the Batch entity was deleted (manually removed, purged by cleanup, or deleted by another management operation), so the query returns null.

Common situations: Manual database cleanup deleting ACT_RU_BATCH rows while repeat jobs remain; batch deletion via management API without cancelling its compute-status jobs; environment mismatch (job from a different database).

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/17a5c723e6bf8d93. Report an issue: GitHub.