{"record":{"id":"770d59e90a0b462c","repo":"flowable/flowable-engine","slug":"there-is-no-batch-with-the-id-configuration-770d59","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/ComputeDeleteHistoricProcessInstanceStatusJobHandler.java","lineNumber":56,"sourceCode":"public class ComputeDeleteHistoricProcessInstanceStatusJobHandler implements JobHandler {\n\n    public static final String TYPE = \"compute-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            long totalFailed = createStatusQuery(batch, managementService)\n                    .status(DeleteProcessInstanceBatchConstants.STATUS_FAILED)\n                    .count();\n            if (totalFailed == 0) {\n                List<BatchPart> deleteBatchParts = managementService.createBatchPartQuery()\n                        .batchId(batch.getId())","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/ComputeDeleteHistoricProcessInstanceStatusJobHandler.java#L38-L74","documentation":"ComputeDeleteHistoricProcessInstanceStatusJobHandler.execute queries a Batch by the job's configuration id (via createBatchQuery().batchId(configuration)). If no batch exists with that id it throws FlowableIllegalArgumentException. This means a status-check repeat job is referencing a batch that no longer exists (deleted or purged).","triggerScenarios":"A repeating delete-historic-process-instance status job fires with a configuration (batch id) that does not resolve to any batch in ACT_RU_BATCH — e.g. the batch row was deleted while its jobs remained.","commonSituations":"Manual deletion of batch rows from the runtime tables; batch cleanup/purge jobs removing a batch but leaving repeat timer jobs; restoring data from backups where batch rows were lost.","solutions":["Verify the batch id in the job's configuration still exists (select from ACT_RU_BATCH) before the job runs.","Delete the orphaned job whose configuration references the missing batch.","Use BatchService/ManagementService to cancel the batch properly instead of deleting rows directly.","Re-trigger the historic process instance deletion to recreate the batch."],"exampleFix":"// before\nmanagementService.deleteBatch(batchId); // leaves orphan repeat jobs\n// after\nmanagementService.deleteBatch(batchId);\nmanagementService.moveJobToDeadLetterJob(...) // or cancel associated repeat jobs first","handlingStrategy":"validation","validationCode":"Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\nif (batch == null) {\n    // batch is gone; cancel/skip the job instead of letting the handler throw\n}","typeGuard":null,"tryCatchPattern":"try {\n    // trigger job execution\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"There is no batch with the id\")) {\n        // delete or ignore the orphaned job\n    } else {\n        throw e;\n    }\n}","preventionTips":["Never delete ACT_RU_BATCH rows manually; use managementService.deleteBatch.","After batch cleanup, search for and remove orphaned repeat jobs referencing deleted batch ids."],"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"}