{"record":{"id":"2f77d441d2c90006","repo":"flowable/flowable-engine","slug":"no-batch-part-found-for-id-batchpartid-2f77d4","errorCode":null,"errorMessage":"No batch part found for id ${batchPartId}","messagePattern":"No batch part found for id (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetBatchPartDocumentCmd.java","lineNumber":35,"sourceCode":"import org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;\nimport org.flowable.engine.impl.util.CommandContextUtil;\n\npublic class GetBatchPartDocumentCmd implements Command<String> {\n    \n    protected String batchPartId;\n    \n    public GetBatchPartDocumentCmd(String batchPartId) {\n        this.batchPartId = batchPartId;\n    }\n    \n    @Override\n    public String execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        BatchPart batchPart = processEngineConfiguration.getBatchServiceConfiguration().getBatchService().getBatchPart(batchPartId);\n        if (batchPart == null) {\n            throw new FlowableObjectNotFoundException(\"No batch part found for id \" + batchPartId);\n        }\n        \n        return batchPart.getResultDocumentJson(processEngineConfiguration.getEngineCfgKey());\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":41,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetBatchPartDocumentCmd.java#L17-L41","documentation":"GetBatchPartDocumentCmd fetches a batch part by id and returns its result document JSON for the current engine config key. If no batch part exists for the id, it throws FlowableObjectNotFoundException. A valid batch part can also yield a null/empty result if the document is not yet available, but this specific error fires only when the part itself is missing.","triggerScenarios":"Calling managementService.getBatchPartDocument(batchPartId) with an unknown, mistyped, or already-deleted batch part id; passing a batch id instead of a batch-part id.","commonSituations":"Retrieving a result document for a finished batch that has been purged; constructing the id from a wrong source; calling before the batch part was persisted.","solutions":["Look up valid ids with managementService.createBatchPartQuery() before fetching the document","Ensure the batch part exists and has completed before reading its result document","Verify you are passing a batch-part id, not a batch id","Handle FlowableObjectNotFoundException to treat missing documents as 'not finished/purged'"],"exampleFix":"// before\nString doc = managementService.getBatchPartDocument(userProvidedId);\n// after\nBatchPart part = managementService.getBatchPart(userProvidedId);\nString doc = part != null ? managementService.getBatchPartDocument(userProvidedId) : null;","handlingStrategy":"try-catch","validationCode":"if (managementService.createBatchPartQuery().batchPartId(batchPartId).count() == 0) return null;","typeGuard":null,"tryCatchPattern":"try {\n    String json = managementService.getBatchPartDocument(batchPartId);\n} catch (FlowableObjectNotFoundException e) {\n    String json = null; // document/part unavailable\n}","preventionTips":["Check batch part existence before reading its result document","Only read documents for completed batch parts","Never reuse ids across engines/datasources"],"tags":["flowable","batch","document","not-found"],"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-14T11:17:12.474Z"}