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
DeleteHistoricProcessInstanceIdsStatusJobHandler.execute queries a Batch by the job's configuration id via createBatchQuery().batchId(configuration). If the query returns null it throws FlowableIllegalArgumentException: the status-monitoring repeat job references a batch that no longer exists in the runtime batch table.
Solutions
- Confirm the batch id exists in ACT_RU_BATCH; if not, remove the orphaned repeat job.
- Cancel batches through managementService.deleteBatch or BatchService so related jobs are cleaned up.
- Re-run the batch delete operation to recreate a valid batch and its status job.
Example fix
// before // rows removed manually, jobs left behind DELETE FROM ACT_RU_BATCH WHERE ID_ = 'batchId'; // after managementService.deleteBatch(batchId); // also removes related jobs/parts
Defensive patterns
Strategy: validation
Validate before calling
Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();
if (batch == null) {
// cancel the status job; the batch no longer exists
} Try / catch
try {
// trigger status job
} catch (FlowableIllegalArgumentException e) {
if (e.getMessage().startsWith("There is no batch with the id")) {
job.setRepeat(null); // stop the repeat, batch is gone
} else {
throw e;
}
} Prevention
- Cancel batches via the ManagementService/BatchService, not direct SQL.
- When restoring environments, restore batch tables together with their job tables.
When it happens
Trigger: A batch status-check job fires with a configuration (batch id) for which createBatchQuery().batchId(id).singleResult() returns null — the batch was deleted or purged while its repeat job remained.
Common situations: Manual/purge deletion of ACT_RU_BATCH rows; incomplete batch cancellation leaving status jobs behind; environment restore where batch rows were dropped.
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
- There is no batch with the id
- There is no batch part with the id
- batch entity not found for id
- batch entity not found for id
- batch has to be provided
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1337676bbba2cfed.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsStatusJobHandler.java:56
public class DeleteHistoricProcessInstanceIdsStatusJobHandler implements JobHandler {
public static final String TYPE = "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) {
List<BatchPart> failedParts = createStatusQuery(batch, managementService)
.status(DeleteProcessInstanceBatchConstants.STATUS_FAILED)
.list();
long totalFailed = failedParts.size();
if (totalFailed == 0) {
completeBatch(batch, DeleteProcessInstanceBatchConstants.STATUS_COMPLETED, engineConfiguration);View on GitHub (pinned to d6d39ce1c6)