{"record":{"id":"a1803dd91ceabaad","repo":"flowable/flowable-engine","slug":"could-not-find-a-event-subscription-with-id-eve","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-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/EventSubscriptionResource.java","lineNumber":59,"sourceCode":"    protected CmmnRestResponseFactory restResponseFactory;\n\n    @Autowired\n    protected CmmnRuntimeService runtimeService;\n    \n    @Autowired(required=false)\n    protected CmmnRestApiInterceptor 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 = \"/cmmn-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-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/EventSubscriptionResource.java#L41-L69","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the eventSubscriptionId exists via GET /cmmn-runtime/event-subscriptions (collection query) or query ACT_RU_EVENT_SUBSCR.","Re-fetch the case instance's plan items/event subscriptions right before use, since subscriptions are transient and deleted once signaled.","Confirm you are connected to the correct database/tenant where the case is running.","Handle FlowableObjectNotFoundException (404) in the client and treat it as 'subscription no longer active' rather than retrying."],"exampleFix":"// before\nEventSubscriptionResponse resp = client.get(\"/cmmn-runtime/event-subscriptions/\" + staleId);\n// after\nList<EventSubscriptionResponse> subs = client.get(\"/cmmn-runtime/event-subscriptions?caseInstanceId=\" + caseId);\nif (subs.isEmpty()) { /* subscription gone; re-derive or skip */ }","handlingStrategy":"try-catch","validationCode":"// pre-check\nEventSubscriptionResponse s = rest.get(\"/cmmn-runtime/event-subscriptions?caseInstanceId=\" + caseId)\n    .stream().filter(e -> e.getId().equals(subId)).findFirst().orElse(null);\nif (s == null) throw new IllegalStateException(\"event subscription gone: \" + subId);","typeGuard":"function subscriptionExists(sub) { return sub && typeof sub.id === 'string' && sub.id.length > 0; }","tryCatchPattern":"try { return api.getEventSubscription(id); }\ncatch (FlowableObjectNotFoundException e) {\n  if (e.getResourceClass() == EventSubscription.class) { refreshCaseSubscriptions(); return null; }\n  throw e;\n}","preventionTips":["Treat event subscription IDs as ephemeral: re-list before use.","Do not cache subscription IDs across case executions or restarts.","Confirm database/tenant routing before querying."],"tags":["rest-api","not-found","event-subscription","cmmn"],"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"}