flowable/flowable-engine · error · FlowableObjectNotFoundException
Could not find a event subscription with id '${eventSubscrip
Error message
Could not find a event subscription with id '${eventSubscriptionId}'. What it means
FlowableObjectNotFoundException thrown when querying an event subscription by id that does not exist. runtimeService.createEventSubscriptionQuery().id(id) returned no result, so the REST endpoint reports a 404 with EventSubscription.class as the missing type.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/EventSubscriptionResource.java:59
protected RestResponseFactory restResponseFactory;
@Autowired
protected RuntimeService runtimeService;
@Autowired(required=false)
protected BpmnRestApiInterceptor restApiInterceptor;
@ApiOperation(value = "Get a single event subscription", tags = { "Event subscriptions" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the event subscription exists and is returned."),
@ApiResponse(code = 404, message = "Indicates the requested event subscription does not exist.")
})
@GetMapping(value = "/runtime/event-subscriptions/{eventSubscriptionId}", produces = "application/json")
public EventSubscriptionResponse getEventSubscription(@ApiParam(name = "eventSubscriptionId") @PathVariable String eventSubscriptionId) {
EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().id(eventSubscriptionId).singleResult();
if (eventSubscription == null) {
throw new FlowableObjectNotFoundException("Could not find a event subscription with id '" + eventSubscriptionId + "'.", EventSubscription.class);
}
if (restApiInterceptor != null) {
restApiInterceptor.accessEventSubscriptionById(eventSubscription);
}
return restResponseFactory.createEventSubscriptionResponse(eventSubscription);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the id via GET /runtime/event-subscriptions filtered by processInstanceId or using the management/API listing before fetching by id.
- Re-fetch the id from the current process state — the subscription may have been consumed and removed.
- Check you are connected to the same database/tenant where the process instance runs.
- Catch FlowableObjectNotFoundException (HTTP 404) and treat as absent resource rather than retrying.
Example fix
// before
GET /runtime/event-subscriptions/1234-not-a-subscription-id
// after
String subId = eventSubscriptions.stream()
.filter(s -> s.getProcessInstanceId().equals(pid)).findFirst()
.map(EventSubscriptionResponse::getId).orElse(null);
if (subId != null) GET /runtime/event-subscriptions/ + subId; Defensive patterns
Strategy: try-catch
Validate before calling
const subs = await fetch(`/runtime/event-subscriptions?processInstanceId=${pid}`).then(r => r.json());
if (!subs.data.some(s => s.id === eventSubscriptionId)) throw new Error(`Subscription ${eventSubscriptionId} no longer exists`); Try / catch
try { /* get event subscription */ } catch (e) {
if (e.status === 404) { /* treat as consumed/deleted, re-derive id */ } else throw e;
} Prevention
- Treat event-subscription ids as ephemeral — they vanish when the event fires
- Re-query subscriptions by processInstanceId instead of caching ids
- Verify you are on the same database/tenant as the process instance
When it happens
Trigger: GET /runtime/event-subscriptions/{eventSubscriptionId} with an id that was never created, was already deleted, or is malformed.
Common situations: Using a process-instance or execution id instead of an event-subscription id; the subscription was consumed/cancelled (e.g. message received, signal fired, timer expired) between lookups; stale ids cached by the client; querying across a different database/tenant than where the subscription lives.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not find a case instance with id '${caseInstanceId}'.
- Historic task instance '' variable value for couldn't be fo
- Historic variable instance '' couldn't be found.
- Timer job with id '' doesn't have an exception stacktrace.
- Suspended job with id '' doesn't have an exception stacktrac
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/dc630a24934f19f2.
Report an issue: GitHub.