flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find an event definition with id

Error message

Could not find an event definition with id '${eventDefinitionId}'.

What it means

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.

Solutions

  1. Query the list of event definitions (GET .../event-definitions) and pick a valid id.
  2. Verify the event registry deployment containing the definition succeeded.
  3. Check tenant filtering — the definition may exist under a different tenantId.
  4. Catch FlowableObjectNotFoundException and fall back to lookup by key.

Example fix

// before
EventDefinition d = repo.createEventDefinitionQuery().eventDefinitionId("missing").singleResult();
// after
EventDefinition d = repo.createEventDefinitionQuery().eventDefinitionId(id).singleResult();
if (d == null) {
    d = repo.createEventDefinitionQuery().eventDefinitionKey(key).latestVersion().singleResult();
}
Defensive patterns

Strategy: try-catch

Validate before calling

EventDefinition def = repositoryService.createEventDefinitionQuery()
    .eventDefinitionId(id).singleResult();
if (def == null) {
    // fall back to key lookup or abort
}

Type guard

null

Try / catch

try {
    getEventDefinition(id);
} catch (FlowableObjectNotFoundException e) {
    logger.warn("Event definition {} not found", id);
}

Prevention

When it happens

Trigger: GET /event-registry-repository/event-definitions/{eventDefinitionId} with an id that does not exist (typo, wrong tenant, deleted definition).

Common situations: Hardcoded ids from another environment; definition deleted after redeployment; querying before the event registry is deployed.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/EventDefinitionResourceDataResource.java:56

    @ApiOperation(value = "Get an event definition resource content", tags = { "Event Definitions" })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates both event definition and resource have been found and the resource data has been returned."),
            @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.")
    })
    @GetMapping(value = "/event-registry-repository/event-definitions/{eventDefinitionId}/resourcedata")
    public byte[] getEventDefinitionResource(@ApiParam(name = "eventDefinitionId") @PathVariable String eventDefinitionId, HttpServletResponse response) {
        EventDefinition eventDefinition = getEventDefinitionFromRequest(eventDefinitionId);
        return getDeploymentResourceData(eventDefinition.getDeploymentId(), eventDefinition.getResourceName(), response);
    }

    /**
     * Returns the {@link EventDefinition} that is requested. Throws the right exceptions when bad request was made or definition was not found.
     */
    protected EventDefinition getEventDefinitionFromRequest(String eventDefinitionId) {
        EventDefinition eventDefinition = repositoryService.createEventDefinitionQuery().eventDefinitionId(eventDefinitionId).singleResult();

        if (eventDefinition == null) {
            throw new FlowableObjectNotFoundException("Could not find an event definition with id '" + eventDefinitionId + "'.", EventDefinition.class);
        }

        if (restApiInterceptor != null) {
            restApiInterceptor.accessEventDefinitionById(eventDefinition);
        }

        return eventDefinition;
    }
}

View on GitHub (pinned to d6d39ce1c6)