flowable/flowable-engine · error · FlowableObjectNotFoundException
No batch part found for id ${batchPartId}
Error message
No batch part found for id ${batchPartId} What it means
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.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetBatchPartDocumentCmd.java:35
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.util.CommandContextUtil;
public class GetBatchPartDocumentCmd implements Command<String> {
protected String batchPartId;
public GetBatchPartDocumentCmd(String batchPartId) {
this.batchPartId = batchPartId;
}
@Override
public String execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
BatchPart batchPart = processEngineConfiguration.getBatchServiceConfiguration().getBatchService().getBatchPart(batchPartId);
if (batchPart == null) {
throw new FlowableObjectNotFoundException("No batch part found for id " + batchPartId);
}
return batchPart.getResultDocumentJson(processEngineConfiguration.getEngineCfgKey());
}
}
View on GitHub (pinned to d6d39ce1c6)
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'
Example fix
// before String doc = managementService.getBatchPartDocument(userProvidedId); // after BatchPart part = managementService.getBatchPart(userProvidedId); String doc = part != null ? managementService.getBatchPartDocument(userProvidedId) : null;
Defensive patterns
Strategy: try-catch
Validate before calling
if (managementService.createBatchPartQuery().batchPartId(batchPartId).count() == 0) return null;
Try / catch
try {
String json = managementService.getBatchPartDocument(batchPartId);
} catch (FlowableObjectNotFoundException e) {
String json = null; // document/part unavailable
} Prevention
- Check batch part existence before reading its result document
- Only read documents for completed batch parts
- Never reuse ids across engines/datasources
When it happens
Trigger: Calling managementService.getBatchPartDocument(batchPartId) with an unknown, mistyped, or already-deleted batch part id; passing a batch id instead of a batch-part id.
Common situations: 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.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Batch with id '${batchId}' does not have a batch document.
- No batch found for id ${batchId}
- No batch part found for id ${batchPartId}
- No batch found for id ${batchId}
- Batch part with id '${batchPartId}' does not have a batch pa
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/2f77d441d2c90006.
Report an issue: GitHub.