{"record":{"id":"7d308bc52411b92a","repo":"flowable/flowable-engine","slug":"batch-with-id-batchid-does-not-have-a-batch-d","errorCode":null,"errorMessage":"Batch with id '${batchId}' does not have a batch document.","messagePattern":"Batch with id '(.+?)' does not have a batch document\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/BatchResource.java","lineNumber":83,"sourceCode":"    public BatchSummaryResponse getBatchSummary(@ApiParam(name = \"batchId\") @PathVariable String batchId) {\n        getBatchById(batchId);\n        BatchSummary batchSummary = managementService.getBatchSummary(batchId);\n        return restResponseFactory.createBatchSummaryResponse(batchSummary);\n    }\n\n    @ApiOperation(value = \"Get the batch document\", tags = { \"Batches\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the requested batch was found and the batch document has been returned. The response contains the raw batch document and always has a Content-type of application/json.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested batch was not found or the job does not have a batch document. Status-description contains additional information about the error.\")\n    })\n    @GetMapping(\"/management/batches/{batchId}/batch-document\")\n    public String getBatchDocument(@ApiParam(name = \"batchId\") @PathVariable String batchId, HttpServletResponse response) {\n        Batch batch = getBatchById(batchId);\n\n        String batchDocument = managementService.getBatchDocument(batchId);\n\n        if (batchDocument == null) {\n            throw new FlowableObjectNotFoundException(\"Batch with id '\" + batch.getId() + \"' does not have a batch document.\", String.class);\n        }\n\n        response.setContentType(\"application/json\");\n        return batchDocument;\n    }\n\n    @ApiOperation(value = \"Delete a batch\", tags = { \"Batches\" }, nickname = \"deleteBatch\", code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the batch was found and has been deleted. Response-body is intentionally empty.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested batch was not found.\")\n    })\n    @DeleteMapping(\"/management/batches/{batchId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void deleteJob(@ApiParam(name = \"batchId\") @PathVariable String batchId) {\n        Batch batch = getBatchById(batchId);\n        if (restApiInterceptor != null) {\n            restApiInterceptor.deleteBatch(batch);\n        }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/BatchResource.java#L65-L101","documentation":"GET /management/batches/{batchId}/content fetches the batch's document JSON through managementService.getBatchDocument. The batch itself exists, but no document was stored for it, so the endpoint throws FlowableObjectNotFoundException with String.class as the missing type. Flowable only stores a batch document when one is provided at batch creation time.","triggerScenarios":"Requesting the document of a batch that was created without a document payload, or after the document column was cleared.","commonSituations":"Batches created by custom code that omitted the document; migrations where the document column is null; clients assuming every batch has content (e.g. migration batches usually do, ad-hoc ones may not).","solutions":["Ensure the batch was created with a document (the value passed to the batch creation call); recreate the batch with a document if it is required.","For built-in migration batches, confirm the batch is a migration batch — other batch types may legitimately have no document.","Treat the 404 as 'no document stored' in the client and proceed without content or use a default.","Inspect the ACT_RU_BATCH DOC column for the id to confirm the document was never stored."],"exampleFix":"// before\nString doc = managementService.getBatchDocument(batchId); // throws if no document stored\n// after\nBatch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\nString doc = managementService.getBatchDocument(batchId);\nif (doc == null) { doc = \"{}\"; /* batch has no stored document */ }","handlingStrategy":"try-catch","validationCode":"Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\n// existence of the batch does not guarantee a document; pre-check only narrows the failure","typeGuard":null,"tryCatchPattern":"try { doc = client.getBatchDocument(batchId); }\ncatch (FlowableObjectNotFoundException e) { doc = null; /* batch stored without a document */ }","preventionTips":["Create batches with a document when clients will fetch content.","Only assume a document exists for batch types that always store one (e.g. process-migration batches).","Check the batch table's document column when debugging.","Handle the 404 as 'no content' rather than a hard failure."],"tags":["rest-api","flowable","not-found","batch","document"],"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"}