flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find a process instance with id '" +…
Error message
Could not find a process instance with id '" + processInstanceId + "'.
What it means
getProcessInstanceFromRequestWithoutAccessCheck queries runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() and throws FlowableObjectNotFoundException when no running process instance matches the given id. Note it only sees running instances, not completed/historic ones.
Solutions
- Verify the processInstanceId exists via /runtime/process-instances list query
- If the instance may have completed, query /history/historic-process-instances/{id} instead
- Check that you are using the process instance id (e.g. '5001') and not the business key or definition id
Example fix
// before GET /runtime/process-instances/5001 // instance already completed -> 404 // after GET /history/historic-process-instances/5001
Defensive patterns
Strategy: try-catch
Validate before calling
const list = await api.get('/runtime/process-instances?processInstanceId=' + id); if (!list.data || list.data.length === 0) { /* fall back to history endpoint */ } Type guard
function isNotFound(e) { return e && (e.status === 404 || e.message.includes('Could not find a process instance')); } Try / catch
try { return await api.get('/runtime/process-instances/' + id); } catch (e) { if (e.status === 404) return await api.get('/history/historic-process-instances/' + id); throw e; } Prevention
- Distinguish runtime vs historic endpoints: runtime only has running instances
- Never use the business key as the process instance id
- Re-fetch instance lists rather than caching ids across long-running workflows
When it happens
Trigger: GET /runtime/process-instances/{processInstanceId} with an id that does not exist, was mistyped, or refers to a process instance that has already ended (only history retains those).
Common situations: Client cached an id of an instance that finished between calls; confusion between process instance id and business key or process definition id; querying a historic instance through the runtime endpoint instead of /history/historic-process-instances.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Batch part with id ' ' does not have a batch part document.
- Batch with id ' ' does not have a batch document.
- Cannot find process definition with id
- Cannot find process instance with id
- Cannot find process instance with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/fbc16a5b4bdbbd68.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseProcessInstanceResource.java:395
*/
protected ProcessInstance getProcessInstanceFromRequest(String processInstanceId) {
ProcessInstance processInstance = getProcessInstanceFromRequestWithoutAccessCheck(processInstanceId);
if (restApiInterceptor != null) {
restApiInterceptor.accessProcessInstanceInfoById(processInstance);
}
return processInstance;
}
/**
* Returns the {@link ProcessInstance} that is requested without calling the access interceptor
* Throws the right exceptions when bad request was made or instance was not found.
*/
protected ProcessInstance getProcessInstanceFromRequestWithoutAccessCheck(String processInstanceId) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (processInstance == null) {
throw new FlowableObjectNotFoundException("Could not find a process instance with id '" + processInstanceId + "'.");
}
return processInstance;
}
}
View on GitHub (pinned to d6d39ce1c6)