{"record":{"id":"1337676bbba2cfed","repo":"flowable/flowable-engine","slug":"there-is-no-batch-with-the-id-configuration-133767","errorCode":null,"errorMessage":"There is no batch with the id ${configuration}","messagePattern":"There is no batch with the id (.+?)","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsStatusJobHandler.java","lineNumber":56,"sourceCode":"public class DeleteHistoricProcessInstanceIdsStatusJobHandler implements JobHandler {\n\n    public static final String TYPE = \"delete-historic-process-status\";\n\n    @Override\n    public String getType() {\n        return TYPE;\n    }\n\n    @Override\n    public void execute(JobEntity job, String configuration, VariableScope variableScope, CommandContext commandContext) {\n        ProcessEngineConfigurationImpl engineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ManagementService managementService = engineConfiguration.getManagementService();\n        Batch batch = managementService.createBatchQuery()\n                .batchId(configuration)\n                .singleResult();\n\n        if (batch == null) {\n            throw new FlowableIllegalArgumentException(\"There is no batch with the id \" + configuration);\n        }\n\n        if (DeleteProcessInstanceBatchConstants.STATUS_STOPPED.equals(batch.getStatus())) {\n            // The batch has been stopped there is nothing that we need to check anymore, so we will set the repeat to null\n            job.setRepeat(null);\n            return;\n        }\n\n        long totalBatchParts = createStatusQuery(batch, managementService).count();\n        long totalCompleted = createStatusQuery(batch, managementService).completed().count();\n\n        if (totalBatchParts == totalCompleted) {\n            List<BatchPart> failedParts = createStatusQuery(batch, managementService)\n                    .status(DeleteProcessInstanceBatchConstants.STATUS_FAILED)\n                    .list();\n            long totalFailed = failedParts.size();\n            if (totalFailed == 0) {\n                completeBatch(batch, DeleteProcessInstanceBatchConstants.STATUS_COMPLETED, engineConfiguration);","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/DeleteHistoricProcessInstanceIdsStatusJobHandler.java#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"Manual/purge deletion of ACT_RU_BATCH rows; incomplete batch cancellation leaving status jobs behind; environment restore where batch rows were dropped.","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."],"exampleFix":"// before\n// rows removed manually, jobs left behind\nDELETE FROM ACT_RU_BATCH WHERE ID_ = 'batchId';\n// after\nmanagementService.deleteBatch(batchId); // also removes related jobs/parts","handlingStrategy":"validation","validationCode":"Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\nif (batch == null) {\n    // cancel the status job; the batch no longer exists\n}","typeGuard":null,"tryCatchPattern":"try {\n    // trigger status job\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"There is no batch with the id\")) {\n        job.setRepeat(null); // stop the repeat, batch is gone\n    } else {\n        throw e;\n    }\n}","preventionTips":["Cancel batches via the ManagementService/BatchService, not direct SQL.","When restoring environments, restore batch tables together with their job tables."],"tags":["resource-not-found","batch","job-handler","flowable"],"backgroundTag":"record-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}