{"record":{"id":"dc630a24934f19f2","repo":"flowable/flowable-engine","slug":"could-not-find-a-event-subscription-with-id-eve-dc630a","errorCode":null,"errorMessage":"Could not find a event subscription with id '${eventSubscriptionId}'.","messagePattern":"Could not find a event subscription with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/EventSubscriptionResource.java","lineNumber":59,"sourceCode":"    protected RestResponseFactory restResponseFactory;\n\n    @Autowired\n    protected RuntimeService runtimeService;\n    \n    @Autowired(required=false)\n    protected BpmnRestApiInterceptor restApiInterceptor;\n\n    @ApiOperation(value = \"Get a single event subscription\", tags = { \"Event subscriptions\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the event subscription exists and is returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested event subscription does not exist.\")\n    })\n    @GetMapping(value = \"/runtime/event-subscriptions/{eventSubscriptionId}\", produces = \"application/json\")\n    public EventSubscriptionResponse getEventSubscription(@ApiParam(name = \"eventSubscriptionId\") @PathVariable String eventSubscriptionId) {\n        EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().id(eventSubscriptionId).singleResult();\n\n        if (eventSubscription == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a event subscription with id '\" + eventSubscriptionId + \"'.\", EventSubscription.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessEventSubscriptionById(eventSubscription);\n        }\n\n        return restResponseFactory.createEventSubscriptionResponse(eventSubscription);\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/EventSubscriptionResource.java#L41-L69","documentation":"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.","triggerScenarios":"GET /runtime/event-subscriptions/{eventSubscriptionId} with an id that was never created, was already deleted, or is malformed.","commonSituations":"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.","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."],"exampleFix":"// before\nGET /runtime/event-subscriptions/1234-not-a-subscription-id\n// after\nString subId = eventSubscriptions.stream()\n    .filter(s -> s.getProcessInstanceId().equals(pid)).findFirst()\n    .map(EventSubscriptionResponse::getId).orElse(null);\nif (subId != null) GET /runtime/event-subscriptions/ + subId;","handlingStrategy":"try-catch","validationCode":"const subs = await fetch(`/runtime/event-subscriptions?processInstanceId=${pid}`).then(r => r.json());\nif (!subs.data.some(s => s.id === eventSubscriptionId)) throw new Error(`Subscription ${eventSubscriptionId} no longer exists`);","typeGuard":null,"tryCatchPattern":"try { /* get event subscription */ } catch (e) {\n  if (e.status === 404) { /* treat as consumed/deleted, re-derive id */ } else throw e;\n}","preventionTips":["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"],"tags":["rest-api","event-subscription","not-found","flowable"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}