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 DeleteHistoricCaseInstanceIdsStatusJobHandler.execute() when its periodic status-check job cannot find a Batch with the id in the job configuration. Like the compute-status handler, it needs the batch to decide whether the deletion finished or was stopped.

Source

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

public class DeleteHistoricCaseInstanceIdsStatusJobHandler implements JobHandler {

    public static final String TYPE = "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) {
            List<BatchPart> failedParts = createStatusQuery(batch, managementService)
                    .status(DeleteCaseInstanceBatchConstants.STATUS_FAILED)
                    .list();
            long totalFailed = failedParts.size();

            if (totalFailed == 0) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Cancel the status/repeat job when deleting the batch
  2. Verify the job configuration id matches an existing row in ACT_RU_BATCH
  3. Ensure the job executes against the same database/engine where the batch exists
  4. Purge leftover jobs after bulk data cleanups

Example fix

// before
managementService.deleteBatch(batchId); // status jobs still firing
// after
managementService.deleteBatch(batchId);
// also cancel jobs whose configuration equals batchId
managementService.deleteJobsForBatch(batchId);
Defensive patterns

Strategy: try-catch

Validate before calling

Batch b = managementService.createBatchQuery().batchId(batchId).singleResult();
if (b == null) { managementService.deleteJob(jobId); return; }

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 status job fires after the parent Batch was removed from the database (manual purge, management-API deletion without cancelling jobs, or wrong engine/database), so the batch query returns null.

Common situations: Database cleanup deleting ACT_RU_BATCH rows while repeat status jobs remain; cross-environment job execution; batch deleted concurrently with job execution.

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