pinpoint-apm/pinpoint · info · ResponseStatusException

agent event not found

Error message

agent event not found

What it means

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.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java:125

        }
        return result;
    }

    @GetMapping(value = "/getAgentEvent")
    public AgentEvent getAgentEvent(
            @ServiceParam ServiceName serviceName,
            @RequestParam("agentId") @NotBlank String agentId,
            @RequestParam("eventTimestamp") Timestamp eventTimestamp,
            @RequestParam("eventTypeCode") int eventTypeCode
    ) {
        final AgentEventType eventType = AgentEventType.getTypeByCode(eventTypeCode);
        if (eventType == null) {
            throw new IllegalArgumentException("invalid eventTypeCode [" + eventTypeCode + "]");
        }

        AgentEvent result = this.agentEventService.getAgentEvent(agentId, eventTimestamp.getEpochMillis(), eventType);
        if (result == null) {
            throw new ResponseStatusException(HttpStatus.NOT_FOUND, "agent event not found");
        }
        return result;
    }

    @PreAuthorize("@naverPermissionEvaluator.hasInspectorPermission(#serviceName.getName(), new com.navercorp.pinpoint.common.server.bo.AgentParam(#agentId, #to))")
    @GetMapping(value = "/getAgentEvents")
    public List<AgentEvent> getAgentEvents(
            @ServiceParam ServiceName serviceName,
            @RequestParam("agentId") @NotBlank String agentId,
            @RequestParam("from") Timestamp from,
            @RequestParam("to") Timestamp to,
            @RequestParam(value = "exclude", defaultValue = "") int[] excludeEventTypeCodes) {
        final Range range = Range.between(from, to);
        final Set<AgentEventType> excludeEventTypes = getAgentEventTypes(excludeEventTypeCodes);
        AgentEventQuery exclude = AgentEventQuery.exclude(excludeEventTypes);
        return this.agentEventService.getAgentEvents(agentId, range, exclude);
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Use /getAgentEvents (plural) to list actually recorded events, then query an exact eventTimestamp from that list
  2. Verify the timestamp precision (epoch millis)
  3. Check retention settings on the agentEvent table

Example fix

// before
getAgentEvent(agentId, guessedTs, code)
// after
List<AgentEvent> events = getAgentEvents(agentId, from, to);
AgentEvent e = events.stream().filter(ev -> ev.getEventTypeCode() == code).findFirst().orElse(null);
Defensive patterns

Strategy: fallback

Validate before calling

List<AgentEvent> events = api.getAgentEvents(agentId, from, to); boolean exists = events.stream().anyMatch(e -> e.getEventTypeCode() == code && e.getEventTimestamp() == ts);

Try / catch

try { return api.getAgentEvent(id, ts, code); } catch (ResponseStatusException e) { if (e.getStatus() == HttpStatus.NOT_FOUND) return Optional.empty(); throw e; }

Prevention

When it happens

Trigger: GET /getAgentEvent with a valid eventTypeCode but a timestamp at which that event was never recorded for the agent.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/9765fe720e0b5321. Report an issue: GitHub.