{"record":{"id":"12ea16cd22c3b992","repo":"flowable/flowable-engine","slug":"there-is-no-batch-part-with-the-id-configuration","errorCode":null,"errorMessage":"There is no batch part with the id ${configuration}","messagePattern":"There is no batch part 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/DeleteHistoricCaseInstanceIdsJobHandler.java","lineNumber":60,"sourceCode":" * @author Filip Hrisafov\n */\npublic class DeleteHistoricCaseInstanceIdsJobHandler implements JobHandler {\n\n    public static final String TYPE = \"delete-historic-case-ids\";\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        BatchService batchService = engineConfiguration.getBatchServiceConfiguration().getBatchService();\n\n        BatchPart batchPart = batchService.getBatchPart(configuration);\n        if (batchPart == null) {\n            throw new FlowableIllegalArgumentException(\"There is no batch part with the id \" + configuration);\n        }\n\n        Batch batch = batchService.getBatch(batchPart.getBatchId());\n        if (DeleteCaseInstanceBatchConstants.STATUS_STOPPED.equals(batch.getStatus())) {\n            batchService.completeBatchPart(batchPart.getId(), DeleteCaseInstanceBatchConstants.STATUS_STOPPED, null);\n            return;\n        }\n\n        CmmnManagementService managementService = engineConfiguration.getCmmnManagementService();\n\n        BatchPart computeBatchPart = managementService.createBatchPartQuery()\n                .id(batchPart.getSearchKey())\n                .singleResult();\n\n        JsonNode computeBatchPartResult = getBatchPartResult(computeBatchPart, engineConfiguration);\n        JsonNode idsToDelete = computeBatchPartResult.path(\"caseInstanceIdsToDelete\");\n        Set<String> caseInstanceIdsToDelete = new HashSet<>();\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delete/DeleteHistoricCaseInstanceIdsJobHandler.java#L42-L78","documentation":"Thrown by DeleteHistoricCaseInstanceIdsJobHandler.execute() when the BatchService cannot find a BatchPart with the id stored in the job's configuration. The handler needs the batch part to report per-id deletion results back to the parent batch.","triggerScenarios":"A worker job for deleting historic case instance ids runs, but its configured batchPartId no longer exists in the BatchService (part completed and removed, deleted manually, or wrong database/engine).","commonSituations":"Orphaned async jobs after batch parts were purged; re-running jobs on a restored/cleaned database; environment mismatch between job and batch storage.","solutions":["Verify the job's configuration id exists in ACT_RU_BATCH_PART before executing","Delete orphaned jobs whose batch parts no longer exist","Check the engine is connected to the same database where the batch was created","If the batch was stopped/completed, mark the job done instead of retrying"],"exampleFix":"// before\nhandler.execute(job, stalePartId, scope, ctx); // throws\n// after\nif (batchService.getBatchPart(partId) != null) {\n    handler.execute(job, partId, scope, ctx);\n} else {\n    // remove orphaned job\n}","handlingStrategy":"try-catch","validationCode":"if (batchService.getBatchPart(configuration) == null) {\n    // skip/remove the orphaned job\n    return;\n}","typeGuard":null,"tryCatchPattern":"try { jobHandler.execute(job, configuration, scope, ctx); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains(\"no batch part with the id\")) { log.warn(\"Orphaned delete job for missing batch part {}\", configuration, e); } else { throw e; } }","preventionTips":["Delete worker jobs together with their batch parts","Do not re-run historical job data after database restores/purges","Verify ids exist before re-submitting jobs"],"tags":["flowable","cmmn","batch","job","batch-part-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"}