{"record":{"id":"9765fe720e0b5321","repo":"pinpoint-apm/pinpoint","slug":"agent-event-not-found","errorCode":null,"errorMessage":"agent event not found","messagePattern":"agent event not found","errorType":"http","errorClass":"ResponseStatusException","httpStatus":404,"severity":"info","filePath":"web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java","lineNumber":125,"sourceCode":"        }\n        return result;\n    }\n\n    @GetMapping(value = \"/getAgentEvent\")\n    public AgentEvent getAgentEvent(\n            @ServiceParam ServiceName serviceName,\n            @RequestParam(\"agentId\") @NotBlank String agentId,\n            @RequestParam(\"eventTimestamp\") Timestamp eventTimestamp,\n            @RequestParam(\"eventTypeCode\") int eventTypeCode\n    ) {\n        final AgentEventType eventType = AgentEventType.getTypeByCode(eventTypeCode);\n        if (eventType == null) {\n            throw new IllegalArgumentException(\"invalid eventTypeCode [\" + eventTypeCode + \"]\");\n        }\n\n        AgentEvent result = this.agentEventService.getAgentEvent(agentId, eventTimestamp.getEpochMillis(), eventType);\n        if (result == null) {\n            throw new ResponseStatusException(HttpStatus.NOT_FOUND, \"agent event not found\");\n        }\n        return result;\n    }\n\n    @PreAuthorize(\"@naverPermissionEvaluator.hasInspectorPermission(#serviceName.getName(), new com.navercorp.pinpoint.common.server.bo.AgentParam(#agentId, #to))\")\n    @GetMapping(value = \"/getAgentEvents\")\n    public List<AgentEvent> getAgentEvents(\n            @ServiceParam ServiceName serviceName,\n            @RequestParam(\"agentId\") @NotBlank String agentId,\n            @RequestParam(\"from\") Timestamp from,\n            @RequestParam(\"to\") Timestamp to,\n            @RequestParam(value = \"exclude\", defaultValue = \"\") int[] excludeEventTypeCodes) {\n        final Range range = Range.between(from, to);\n        final Set<AgentEventType> excludeEventTypes = getAgentEventTypes(excludeEventTypeCodes);\n        AgentEventQuery exclude = AgentEventQuery.exclude(excludeEventTypes);\n        return this.agentEventService.getAgentEvents(agentId, range, exclude);\n    }\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java#L107-L143","documentation":"Validation and 404 guard in AgentInfoController.getAgentEvent. First, if eventTypeCode does not map to a known AgentEventType, an IllegalArgumentException is thrown for the invalid code. Then, when no matching agent event exists for the given agentId, eventTimestamp, and resolved event type, the controller raises a ResponseStatusException with NOT_FOUND (the 'agent event not found' case), meaning the agent recorded no such event at that instant. The input at fault is the event query parameters; query only recorded event codes/timestamps.","triggerScenarios":"GET /getAgentEvent with a valid eventTypeCode but a timestamp at which that event was never recorded for the agent.","commonSituations":"Querying event timestamps with second/millis confusion; asking for an event type that never occurred (e.g. AGENT_CLOSED for an agent still running); data purged by TTL.","solutions":["Use /getAgentEvents (plural) to list actually recorded events, then query an exact eventTimestamp from that list","Verify the timestamp precision (epoch millis)","Check retention settings on the agentEvent table"],"exampleFix":"// before\ngetAgentEvent(agentId, guessedTs, code)\n// after\nList<AgentEvent> events = getAgentEvents(agentId, from, to);\nAgentEvent e = events.stream().filter(ev -> ev.getEventTypeCode() == code).findFirst().orElse(null);","handlingStrategy":"fallback","validationCode":"List<AgentEvent> events = api.getAgentEvents(agentId, from, to); boolean exists = events.stream().anyMatch(e -> e.getEventTypeCode() == code && e.getEventTimestamp() == ts);","typeGuard":null,"tryCatchPattern":"try { return api.getAgentEvent(id, ts, code); } catch (ResponseStatusException e) { if (e.getStatus() == HttpStatus.NOT_FOUND) return Optional.empty(); throw e; }","preventionTips":["Take eventTimestamp values from /getAgentEvents results rather than guessing","Use epoch-millis precision","Account for event data TTL/purge windows"],"tags":["http-404","rest-api","agent-events","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}