{"record":{"id":"5119a4d2460f805a","repo":"pinpoint-apm/pinpoint","slug":"invalid-eventtypecode-eventtypecode","errorCode":null,"errorMessage":"invalid eventTypeCode [${eventTypeCode}]","messagePattern":"invalid eventTypeCode \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":500,"severity":"warning","filePath":"web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java","lineNumber":120,"sourceCode":"            @RequestParam(\"agentId\") @NotBlank String agentId,\n            @RequestParam(\"timestamp\") Timestamp timestamp) {\n        AgentStatus result = this.agentInfoService.findAgentStatus(agentId, timestamp.getEpochMillis());\n        if (result == null) {\n            throw new ResponseStatusException(HttpStatus.NOT_FOUND, \"agent status not found\");\n        }\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);","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java#L102-L138","documentation":"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.","triggerScenarios":"GET /getAgentEvent with eventTypeCode that is not any defined AgentEventType code (e.g. 9999 or a code from a different Pinpoint version).","commonSituations":"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.","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"],"exampleFix":"// before\nint code = 9999; // invalid\nAgentEventType t = AgentEventType.getTypeByCode(code);\nif (t == null) throw new IllegalArgumentException(\"invalid eventTypeCode [\" + code + \"]\");\n// after\nAgentEventType t = AgentEventType.getTypeByCode(AgentEventType.AGENT_CLOSED.getCode());","handlingStrategy":"validation","validationCode":"AgentEventType t = AgentEventType.getTypeByCode(code); if (t == null) throw new IllegalArgumentException(\"invalid eventTypeCode [\" + code + \"]\");","typeGuard":"boolean isValidEventTypeCode(int code) { return AgentEventType.getTypeByCode(code) != null; }","tryCatchPattern":"try { return api.getAgentEvent(id, ts, code); } catch (IllegalArgumentException e) { log.warn(\"bad eventTypeCode {}\", code); return null; }","preventionTips":["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"],"tags":["http-400","validation","enum","agent-events"],"backgroundTag":"invalid-enum-value","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"}