{"record":{"id":"b5cc4ad1f601e8dc","repo":"pinpoint-apm/pinpoint","slug":"invalid-pattern-a-za-z0-9","errorCode":null,"errorMessage":"invalid pattern([a-zA-Z0-9._\\-]+)","messagePattern":"invalid pattern\\(\\[a-zA-Z0-9\\._\\\\-\\]\\+\\)","errorType":"http","errorClass":"ResponseStatusException","httpStatus":400,"severity":"warning","filePath":"web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java","lineNumber":188,"sourceCode":"            @ServiceParam ServiceName serviceName,\n            @RequestParam(\"applicationName\") @NotBlank String applicationName,\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        rangeValidator.validate(range);\n        return agentInfoService.getAgentStatusTimeline(serviceName.getName(), applicationName, agentId, range, excludeEventTypeCodes);\n    }\n\n    @RequestMapping(value = \"/isAvailableAgentId\")\n    public CodeResult<String> isAvailableAgentId(@ServiceParam ServiceName serviceName, @RequestParam(\"agentId\") @NotBlank String agentId) {\n        final IdValidateUtils.CheckResult result = IdValidateUtils.checkId(agentId, PinpointConstants.AGENT_ID_MAX_LEN);\n        if (result == IdValidateUtils.CheckResult.FAIL_LENGTH) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"length range is 1 ~ 24\");\n        }\n        if (result == IdValidateUtils.CheckResult.FAIL_PATTERN) {\n            throw new ResponseStatusException(\n                    HttpStatus.BAD_REQUEST,\n                    \"invalid pattern(\" + IdValidateUtils.ID_PATTERN_VALUE + \")\"\n            );\n        }\n        if (agentInfoService.findAgentInfo(agentId, System.currentTimeMillis()) != null) {\n            throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, \"agentId already exists\");\n        }\n        return CodeResult.ok(\"OK\");\n    }\n\n}\n","sourceCodeStart":170,"sourceCodeEnd":200,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentInfoController.java#L170-L200","documentation":"isAvailableAgentId also checks the agentId character pattern via IdValidateUtils; a FAIL_PATTERN result throws HTTP 400 'invalid pattern([a-zA-Z0-9._\\-]+)'. Only alphanumerics, dot, underscore, and hyphen are allowed.","triggerScenarios":"GET /isAvailableAgentId with an agentId containing characters outside [a-zA-Z0-9._-], e.g. spaces, colons, slashes, or non-ASCII characters.","commonSituations":"Using FQDNs with ports ('host:8080') or paths as agent ids; non-ASCII hostnames; ids derived from user input without sanitization.","solutions":["Remove/replace illegal characters with '-', '_', or '.'","Sanitize/normalize the id on the agent side before registration","Pre-validate with regex ^[a-zA-Z0-9._\\-]+$ in the client"],"exampleFix":"// before\nString agentId = \"my host:8080\";\n// after\nString agentId = \"my-host-8080\".replaceAll(\"[^a-zA-Z0-9._\\\\-]\", \"-\");","handlingStrategy":"validation","validationCode":"if (!agentId.matches(\"^[a-zA-Z0-9._\\\\-]+$\")) throw new IllegalArgumentException(\"agentId must match [a-zA-Z0-9._\\\\-]+\");","typeGuard":"boolean isValidAgentIdPattern(String id) { return id != null && id.matches(\"[a-zA-Z0-9._\\\\-]+\"); }","tryCatchPattern":"try { return api.isAvailableAgentId(id); } catch (ResponseStatusException e) { if (e.getStatus() == HttpStatus.BAD_REQUEST) { log.warn(\"invalid agentId pattern: {}\", id); return null; } throw e; }","preventionTips":["Sanitize agent ids with replaceAll(\"[^a-zA-Z0-9._\\\\-]\", \"-\") at generation time","Never build agent ids from raw user input or host:port strings","Share one validation regex between agent config and client tooling"],"tags":["http-400","validation","identifier","regex"],"backgroundTag":"invalid-identifier-format","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"}