{"record":{"id":"7a80c1d4e947e8ad","repo":"flowable/flowable-engine","slug":"there-is-no-batch-with-the-id-configuration-7a80c1","errorCode":null,"errorMessage":"There is no batch with the id ${configuration}","messagePattern":"There is no batch with the id (.+?)","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/DeleteHistoricCaseInstanceIdsStatusJobHandler.java","lineNumber":56,"sourceCode":"public class DeleteHistoricCaseInstanceIdsStatusJobHandler implements JobHandler {\n\n    public static final String TYPE = \"delete-historic-case-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        CmmnEngineConfiguration engineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        CmmnManagementService managementService = engineConfiguration.getCmmnManagementService();\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 (DeleteCaseInstanceBatchConstants.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(DeleteCaseInstanceBatchConstants.STATUS_FAILED)\n                    .list();\n            long totalFailed = failedParts.size();\n\n            if (totalFailed == 0) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/DeleteHistoricCaseInstanceIdsStatusJobHandler.java#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"Database cleanup deleting ACT_RU_BATCH rows while repeat status jobs remain; cross-environment job execution; batch deleted concurrently with job execution.","solutions":["Cancel the status/repeat job when deleting the batch","Verify the job configuration id matches an existing row in ACT_RU_BATCH","Ensure the job executes against the same database/engine where the batch exists","Purge leftover jobs after bulk data cleanups"],"exampleFix":"// before\nmanagementService.deleteBatch(batchId); // status jobs still firing\n// after\nmanagementService.deleteBatch(batchId);\n// also cancel jobs whose configuration equals batchId\nmanagementService.deleteJobsForBatch(batchId);","handlingStrategy":"try-catch","validationCode":"Batch b = managementService.createBatchQuery().batchId(batchId).singleResult();\nif (b == null) { managementService.deleteJob(jobId); return; }","typeGuard":null,"tryCatchPattern":"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()); } }","preventionTips":["Always cancel status jobs when deleting a batch","Never purge ACT_RU_BATCH without purging dependent repeat jobs","Ensure consistent database across engine nodes"],"tags":["flowable","cmmn","batch","job","batch-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}