{"record":{"id":"432c280fd6d20f79","repo":"flowable/flowable-engine","slug":"could-not-find-an-event-definition-with-id-even-432c28","errorCode":null,"errorMessage":"Could not find an event definition with id '${eventDefinitionId}'.","messagePattern":"Could not find an event definition with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/EventDefinitionResourceDataResource.java","lineNumber":56,"sourceCode":"    @ApiOperation(value = \"Get an event definition resource content\", tags = { \"Event Definitions\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates both event definition and resource have been found and the resource data has been returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested event definition was not found or there is no resource with the given id present in the event definition. The status-description contains additional information.\")\n    })\n    @GetMapping(value = \"/event-registry-repository/event-definitions/{eventDefinitionId}/resourcedata\")\n    public byte[] getEventDefinitionResource(@ApiParam(name = \"eventDefinitionId\") @PathVariable String eventDefinitionId, HttpServletResponse response) {\n        EventDefinition eventDefinition = getEventDefinitionFromRequest(eventDefinitionId);\n        return getDeploymentResourceData(eventDefinition.getDeploymentId(), eventDefinition.getResourceName(), response);\n    }\n\n    /**\n     * Returns the {@link EventDefinition} that is requested. Throws the right exceptions when bad request was made or definition was not found.\n     */\n    protected EventDefinition getEventDefinitionFromRequest(String eventDefinitionId) {\n        EventDefinition eventDefinition = repositoryService.createEventDefinitionQuery().eventDefinitionId(eventDefinitionId).singleResult();\n\n        if (eventDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find an event definition with id '\" + eventDefinitionId + \"'.\", EventDefinition.class);\n        }\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessEventDefinitionById(eventDefinition);\n        }\n\n        return eventDefinition;\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/EventDefinitionResourceDataResource.java#L38-L66","documentation":"REST lookup failure in EventDefinitionResourceDataResource.getEventDefinitionFromRequest: no event definition exists in the event registry with the given eventDefinitionId, so its resource data cannot be returned. Usually surfaces as a 404 in the REST layer.","triggerScenarios":"GET /event-registry-repository/event-definitions/{eventDefinitionId} with an id that does not exist (typo, wrong tenant, deleted definition).","commonSituations":"Hardcoded ids from another environment; definition deleted after redeployment; querying before the event registry is deployed.","solutions":["Query the list of event definitions (GET .../event-definitions) and pick a valid id.","Verify the event registry deployment containing the definition succeeded.","Check tenant filtering — the definition may exist under a different tenantId.","Catch FlowableObjectNotFoundException and fall back to lookup by key."],"exampleFix":"// before\nEventDefinition d = repo.createEventDefinitionQuery().eventDefinitionId(\"missing\").singleResult();\n// after\nEventDefinition d = repo.createEventDefinitionQuery().eventDefinitionId(id).singleResult();\nif (d == null) {\n    d = repo.createEventDefinitionQuery().eventDefinitionKey(key).latestVersion().singleResult();\n}","handlingStrategy":"try-catch","validationCode":"EventDefinition def = repositoryService.createEventDefinitionQuery()\n    .eventDefinitionId(id).singleResult();\nif (def == null) {\n    // fall back to key lookup or abort\n}","typeGuard":"null","tryCatchPattern":"try {\n    getEventDefinition(id);\n} catch (FlowableObjectNotFoundException e) {\n    logger.warn(\"Event definition {} not found\", id);\n}","preventionTips":["Look up ids dynamically instead of hardcoding","Verify event registry deployments succeeded in the target environment","Be aware of tenant filtering on queries"],"tags":["rest","not-found","event-definition"],"backgroundTag":"entity-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}