{"record":{"id":"e400745cf8920839","repo":"pinpoint-apm/pinpoint","slug":"invalid-hostgroupname-hostgroupname","errorCode":null,"errorMessage":"invalid hostGroupName='<hostGroupName>'","messagePattern":"invalid hostGroupName='<hostGroupName>'","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/controller/TelegrafMetricController.java","lineNumber":91,"sourceCode":"        this.tenantProvider = Objects.requireNonNull(tenantProvider, \"tenantProvider\");\n    }\n\n\n    @PostMapping(value = \"/telegraf\")\n    public ResponseEntity<String> saveSystemMetric(\n            @RequestHeader(value = \"hostGroupName\") String hostGroupName,\n            @RequestBody TelegrafMetrics telegrafMetrics, BindingResult bindingResult\n    ) throws BindException {\n        if (bindingResult.hasErrors()) {\n            SimpleErrorMessage simpleErrorMessage = new SimpleErrorMessage(bindingResult);\n            logger.warn(\"metric binding error. header=hostGroupName:{} errorCount:{} {}\", hostGroupName, bindingResult.getErrorCount(), simpleErrorMessage);\n            throw new BindException(bindingResult);\n        }\n\n        if (!isValidGroupName(hostGroupName)) {\n            logger.warn(\"invalid hostGroupName='{}'\", hostGroupName);\n            return ResponseEntity.badRequest().body(\"invalid hostGroupName='\" + hostGroupName + \"'\");\n        }\n\n        String hostName = getHost(telegrafMetrics);\n        if (StringUtils.isEmpty(hostName)) {\n            // hostname null check\n            logger.info(\"hostName is empty. hostGroupName={}\", hostGroupName);\n            return ResponseEntity.badRequest().body(\"hostName is empty\");\n        }\n\n        if (!isValidHostName(hostName)) {\n            logger.warn(\"invalid hostName='{}', hostGroupName='{}'\", hostName, hostGroupName);\n        }\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"hostGroupName:{} host:{} size:{}\", hostGroupName, hostName, telegrafMetrics.size());\n        }\n\n        String tenantId = tenantProvider.getTenantId();\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/controller/TelegrafMetricController.java#L73-L109","documentation":"Pinpoint's TelegrafMetricController rejects HTTP requests whose hostGroupName path/query parameter fails isValidGroupName (regex validation). It returns HTTP 400 with the message so telemetry ingestion is refused until a valid group name is supplied.","triggerScenarios":"POSTing telegraf metrics to the system-metric endpoint with a hostGroupName containing characters outside the allowed pattern (spaces, slashes, special characters) or an empty value.","commonSituations":"Telegraf config or client scripts with unencoded or wrong group names; dashboards configured with a group name renamed on the collector; deployments where the telegraf hostGroupName tag contains hostnames with invalid characters.","solutions":["Correct the hostGroupName in the telegraf/client config to match the allowed pattern (alphanumeric, dash, underscore, dot typically)","Check the isValidGroupName regex in TelegrafMetricController and conform to it","URL-encode the hostGroupName in the request path/query","Inspect the 400 response body, which echoes the exact invalid value sent"],"exampleFix":"# before (telegraf.conf)\nurls = [\"http://collector:8080/telegraf/metrics/systemMetric/my group/hosts\"]\n# after\nurls = [\"http://collector:8080/telegraf/metrics/systemMetric/my-group/hosts\"]","handlingStrategy":"validation","validationCode":"function isValidHostGroupName(name) {\n  return typeof name === 'string' && /^[a-zA-Z0-9._-]+$/.test(name);\n}\n// check before POSTing to the telegraf system-metric endpoint","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.length > 0;\n}","tryCatchPattern":"const res = await fetch(url, { method: 'POST', body });\nif (res.status === 400) {\n  const msg = await res.text();\n  if (msg.startsWith('invalid hostGroupName=')) {\n    // fix the group name in config and retry\n  }\n}","preventionTips":["Validate hostGroupName against the collector's regex before deploying telegraf config","Use only alphanumeric characters, dashes, underscores, dots in group names","URL-encode path/query parameters when building metric endpoint URLs","Check for HTTP 400 responses from the metric collector during CI/deploy"],"tags":["http","validation","metrics","pinpoint"],"backgroundTag":"invalid-query-parameter","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"}