{"record":{"id":"a11b88866afb84a8","repo":"flowable/flowable-engine","slug":"no-batch-found-for-id-batchid-a11b88","errorCode":null,"errorMessage":"No batch found for id ${batchId}","messagePattern":"No batch found for id (.+?)","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/BatchPartCollectionResource.java","lineNumber":67,"sourceCode":"    \n    @Autowired(required=false)\n    protected BpmnRestApiInterceptor restApiInterceptor;\n\n    @ApiOperation(value = \"List batch parts\", tags = { \"Batches\" }, nickname = \"listBatchesPart\")\n    @ApiImplicitParams({\n            @ApiImplicitParam(name = \"status\", dataType = \"string\", value = \"Only return batch parts for the given status\", paramType = \"query\")\n    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the requested batch parts were returned.\"),\n            @ApiResponse(code = 400, message = \"Indicates an illegal value has been used in a url query parameter. Status description contains additional details about the error.\")\n    })\n    @GetMapping(value = \"/management/batches/{batchId}/batch-parts\", produces = \"application/json\")\n    public List<BatchPartResponse> getBatches(@PathVariable String batchId,\n                    @ApiParam(hidden = true) @RequestParam Map<String, String> allRequestParams) {\n        \n        Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\n        if (batch == null) {\n            throw new FlowableObjectNotFoundException(\"No batch found for id \" + batchId);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessBatchPartInfoOfBatch(batch);\n        }\n        \n        List<BatchPart> batchParts = null;\n        if (allRequestParams.containsKey(\"status\")) {\n            batchParts = managementService.findBatchPartsByBatchIdAndStatus(batchId, allRequestParams.get(\"status\"));\n        } else {\n            batchParts = managementService.findBatchPartsByBatchId(batchId);\n        }\n\n        return restResponseFactory.createBatchPartResponse(batchParts);\n    }\n}\n","sourceCodeStart":49,"sourceCodeEnd":84,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/BatchPartCollectionResource.java#L49-L84","documentation":"This Flowable REST endpoint (GET /management/batches/{batchId}/batch-parts) looks up a Batch by id via managementService.createBatchQuery().batchId(batchId). When the query returns null because no batch with that id exists, the controller throws FlowableObjectNotFoundException with a message embedding the requested batchId. It is the REST layer's way of turning an unknown batch id into a 404-style response.","triggerScenarios":"Calling GET /management/batches/{batchId}/batch-parts with a batchId that does not exist (typo, batch already completed and deleted, or id from a different database/tenant).","commonSituations":"Using a batch-part id instead of the batch id in the URL; referring to a batch whose history/row was purged by batch cleanup; pointing the REST client at a different Flowable database than where the batch was created.","solutions":["Verify the batchId exists: query ACT_RU_BATCH (or run managementService.createBatchQuery().list()) and use a real id.","Use the batch id (not a batch-part id) in the URL path.","Confirm the REST client points at the same database/tenant where the batch was created.","If batches are purged automatically, re-check lifecycle: a finished batch may no longer be queryable, so handle the 404 in the client."],"exampleFix":"// before\nList<BatchPartResponse> parts = client.get(\"/management/batches/\" + partId + \"/batch-parts\"); // partId used by mistake\n// after\nList<BatchPartResponse> parts = client.get(\"/management/batches/\" + batch.getId() + \"/batch-parts\");","handlingStrategy":"validation","validationCode":"Batch batch = managementService.createBatchQuery().batchId(batchId).singleResult();\nif (batch == null) { throw new IllegalArgumentException(\"Unknown batch id: \" + batchId); }","typeGuard":"if (batchId == null || batchId.isBlank()) { /* reject before calling */ }","tryCatchPattern":"try { parts = restClient.getBatchParts(batchId); }\ncatch (FlowableObjectNotFoundException e) { log.warn(\"Batch {} not found\", batchId); return Collections.emptyList(); }","preventionTips":["Always resolve the batch id from a prior batch-query call instead of hardcoding.","Check ACT_RU_BATCH for the id before invoking the REST endpoint.","Don't confuse batch ids with batch-part ids.","Account for automatic batch cleanup removing finished batches."],"tags":["rest-api","flowable","not-found","batch"],"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"}