flowable/flowable-engine · error · FlowableObjectNotFoundException
No batch part found for id ${batchPartId}
Error message
No batch part found for id ${batchPartId} What it means
GetBatchPartCmd looks up a batch part by id via the batch service. When the batch service returns null (no batch part with that id exists), the command throws FlowableObjectNotFoundException with the id embedded in the message. This means the batch part id is invalid, was mistyped, or the batch part has already been completed and removed.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetBatchPartCmd.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 GetBatchPartCmd implements Command<BatchPart> {
protected String batchPartId;
public GetBatchPartCmd(String batchPartId) {
this.batchPartId = batchPartId;
}
@Override
public BatchPart 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;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the batch part id via managementService.createBatchPartQuery().list() and use an id from the result
- If querying a batch as a whole, use getBatch(batchId) or BatchQuery instead of the batch-part API
- Check application code that retains the id — refresh it before each lookup instead of caching stale ids
- Guard against completed batches by checking batch part status before querying after completion
Example fix
// before
BatchPart part = managementService.getBatchPart(someBatchId); // wrong id / wrong API
// after
BatchPart part = managementService.createBatchPartQuery().batchId(someBatchId).singleResult();
if (part != null) { /* use part */ } Defensive patterns
Strategy: try-catch
Validate before calling
BatchPart p = managementService.createBatchPartQuery().batchPartId(batchPartId).singleResult();
if (p == null) throw new IllegalStateException("Unknown batch part " + batchPartId); Try / catch
try {
BatchPart part = managementService.getBatchPart(batchPartId);
} catch (FlowableObjectNotFoundException e) {
// treat as purged/unknown batch part
} Prevention
- Resolve ids from createBatchPartQuery() rather than user input
- Do not cache batch part ids beyond the batch lifecycle
- Distinguish batch ids from batch-part ids in code and logs
When it happens
Trigger: Calling managementService.getBatchPart(batchPartId) (or any API executing GetBatchPartCmd) with an id that does not correspond to a persistent batch part; the id is a batch id rather than a batch-part id; the batch part was deleted after completion.
Common situations: Polling a batch migration/rotation/instance-change part after it finished and was cleaned up; copying an id from the wrong table/management endpoint; using a process-instance id instead of the batch part id.
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
- No batch found for id ${batchId}
- No batch part found for id ${batchPartId}
- No batch found for id ${batchId}
- Batch with id '${batchId}' does not have a batch document.
- Could not find a batch with id '${batchId}'.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/9451d6d9940792d8.
Report an issue: GitHub.