pinpoint-apm/pinpoint · warning · IllegalArgumentException
invalid eventTypeCode [${eventTypeCode}]
Error message
invalid eventTypeCode [${eventTypeCode}] What it means
AgentInfoController.getAgentEvent validates eventTypeCode via AgentEventType.getTypeByCode; an unrecognised code throws IllegalArgumentException('invalid eventTypeCode [N]'), typically surfacing as HTTP 400/500 depending on the handler.
Source
Thrown at web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java:120
@RequestParam("agentId") @NotBlank String agentId,
@RequestParam("timestamp") Timestamp timestamp) {
AgentStatus result = this.agentInfoService.findAgentStatus(agentId, timestamp.getEpochMillis());
if (result == null) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "agent status not found");
}
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);View on GitHub (pinned to 744c3d3075)
Solutions
- Use a valid AgentEventType code (see com.navercorp.pinpoint.common.server.util.AgentEventType)
- Validate the code client-side against the AgentEventType enum before calling
- Align client and server Pinpoint versions
Example fix
// before
int code = 9999; // invalid
AgentEventType t = AgentEventType.getTypeByCode(code);
if (t == null) throw new IllegalArgumentException("invalid eventTypeCode [" + code + "]");
// after
AgentEventType t = AgentEventType.getTypeByCode(AgentEventType.AGENT_CLOSED.getCode()); Defensive patterns
Strategy: validation
Validate before calling
AgentEventType t = AgentEventType.getTypeByCode(code); if (t == null) throw new IllegalArgumentException("invalid eventTypeCode [" + code + "]"); Type guard
boolean isValidEventTypeCode(int code) { return AgentEventType.getTypeByCode(code) != null; } Try / catch
try { return api.getAgentEvent(id, ts, code); } catch (IllegalArgumentException e) { log.warn("bad eventTypeCode {}", code); return null; } Prevention
- Derive event codes from the AgentEventType enum, not hard-coded literals
- Keep client and server Pinpoint versions aligned
- Validate codes client-side before the REST call
When it happens
Trigger: GET /getAgentEvent with eventTypeCode that is not any defined AgentEventType code (e.g. 9999 or a code from a different Pinpoint version).
Common situations: Hard-coded event codes copied from another Pinpoint version where the enum changed; typos in client code; passing event type names where codes are expected.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid order by type : +orderBy+ not supported.
- No service type provided.
- length range is 1 ~ 24
- invalid pattern([a-zA-Z0-9._\-]+)
- there is not applicationId/checkerName/userGroupId/threashol
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/5119a4d2460f805a.
Report an issue: GitHub.