{"record":{"id":"b2291dc4a5154f79","repo":"flowable/flowable-engine","slug":"task-does-not-have-an-event-with-id","errorCode":null,"errorMessage":"Task '' does not have an event with id ''.","messagePattern":"Task '' does not have an event with id ''\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskEventResource.java","lineNumber":54,"sourceCode":" * @author Frederik Heremans\n */\n@RestController\n@Api(tags = { \"Tasks\" }, authorizations = { @Authorization(value = \"basicAuth\") })\npublic class TaskEventResource extends TaskBaseResource {\n\n    @ApiOperation(value = \"Get an event on a task\", tags = { \"Tasks\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the task and event were found and the event is returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested task was not found or the tasks does not have an event with the given ID.\")\n    })\n    @GetMapping(value = \"/runtime/tasks/{taskId}/events/{eventId}\", produces = \"application/json\")\n    public EventResponse getEvent(@ApiParam(name = \"taskId\") @PathVariable(\"taskId\") String taskId, @ApiParam(name = \"eventId\") @PathVariable(\"eventId\") String eventId) {\n\n        HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);\n\n        Event event = taskService.getEvent(eventId);\n        if (event == null || !task.getId().equals(event.getTaskId())) {\n            throw new FlowableObjectNotFoundException(\"Task '\" + task.getId() + \"' does not have an event with id '\" + eventId + \"'.\", Event.class);\n        }\n\n        return restResponseFactory.createEventResponse(event);\n    }\n\n    @ApiOperation(value = \"Delete an event on a task\", tags = { \"Tasks\" }, code = 204)\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the task was found and the events are returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested task was not found or the task does not have the requested event.\")\n    })\n    @DeleteMapping(value = \"/runtime/tasks/{taskId}/events/{eventId}\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void deleteEvent(@ApiParam(name = \"taskId\") @PathVariable(\"taskId\") String taskId, @ApiParam(name = \"eventId\") @PathVariable(\"eventId\") String eventId) {\n\n        // Check if task exists\n        Task task = getTaskFromRequestWithoutAccessCheck(taskId);\n\n        Event event = taskService.getEvent(eventId);","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskEventResource.java#L36-L72","documentation":"GET /runtime/tasks/{taskId}/events/{eventId} throws FlowableObjectNotFoundException when the event id does not exist or the event's taskId does not match the requested task. Events are engine-generated task lifecycle records (assignment, creation, etc.).","triggerScenarios":"GET /runtime/tasks/{taskId}/events/{eventId} with an unknown eventId or an event belonging to another task.","commonSituations":"Using an event id from a different task or process; event purged by history cleanup; typos in ids copied from logs.","solutions":["Fetch valid event ids via GET /runtime/tasks/{taskId}/events first","Verify the eventId belongs to the same taskId used in the path","Check that history/event cleanup jobs have not purged the event"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const events = await get(`/runtime/tasks/${taskId}/events`);\nif (!events.some(ev => ev.id === eventId)) return null;","typeGuard":null,"tryCatchPattern":"try { ... } catch (e) { if (e.status === 404) return null; throw e; }","preventionTips":["Take event ids only from the task's event list","Account for history cleanup purging events","Copy ids exactly, avoid manual transcription"],"tags":["rest","not-found","flowable","events"],"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-18T11:17:12.947Z"}