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

Thrown by the CMMN REST API when a GET request for an event subscription by ID matches no rows in the runtime event subscription table. Flowable's EventSubscriptionResource queries runtimeService.createEventSubscriptionQuery().id(id).singleResult() and, per REST convention, maps a null result to FlowableObjectNotFoundException with EventSubscription.class as the resource type. It signals the requested ID does not exist (or no longer exists) at runtime.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/EventSubscriptionResource.java:59

    protected CmmnRestResponseFactory restResponseFactory;

    @Autowired
    protected CmmnRuntimeService runtimeService;
    
    @Autowired(required=false)
    protected CmmnRestApiInterceptor 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 = "/cmmn-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

  1. Verify the eventSubscriptionId exists via GET /cmmn-runtime/event-subscriptions (collection query) or query ACT_RU_EVENT_SUBSCR.
  2. Re-fetch the case instance's plan items/event subscriptions right before use, since subscriptions are transient and deleted once signaled.
  3. Confirm you are connected to the correct database/tenant where the case is running.
  4. Handle FlowableObjectNotFoundException (404) in the client and treat it as 'subscription no longer active' rather than retrying.

Example fix

// before
EventSubscriptionResponse resp = client.get("/cmmn-runtime/event-subscriptions/" + staleId);
// after
List<EventSubscriptionResponse> subs = client.get("/cmmn-runtime/event-subscriptions?caseInstanceId=" + caseId);
if (subs.isEmpty()) { /* subscription gone; re-derive or skip */ }
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check
EventSubscriptionResponse s = rest.get("/cmmn-runtime/event-subscriptions?caseInstanceId=" + caseId)
    .stream().filter(e -> e.getId().equals(subId)).findFirst().orElse(null);
if (s == null) throw new IllegalStateException("event subscription gone: " + subId);

Type guard

function subscriptionExists(sub) { return sub && typeof sub.id === 'string' && sub.id.length > 0; }

Try / catch

try { return api.getEventSubscription(id); }
catch (FlowableObjectNotFoundException e) {
  if (e.getResourceClass() == EventSubscription.class) { refreshCaseSubscriptions(); return null; }
  throw e;
}

Prevention

When it happens

Trigger: GET /cmmn-runtime/event-subscriptions/{eventSubscriptionId} with an ID that was never created, was already consumed/cancelled (event subscriptions are deleted once signaled), or belongs to a completed/deleted case instance.

Common situations: Client cached an ID from a previous run against a different database; event subscription was consumed by a signal/message receipt between listing and fetching; querying against wrong tenant/datasource; case instance ended and its subscriptions were removed; typo in the ID.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/a1803dd91ceabaad. Report an issue: GitHub.