{"record":{"id":"abfb859c5a32faea","repo":"pinpoint-apm/pinpoint","slug":"cannot-use-reserved-service-name","errorCode":null,"errorMessage":"Cannot use reserved service name: ","messagePattern":"Cannot use reserved service name: ","errorType":"http","errorClass":"ResponseStatusException","httpStatus":400,"severity":"warning","filePath":"service-module/src/main/java/com/navercorp/pinpoint/service/web/controller/ServiceRegistryController.java","lineNumber":42,"sourceCode":"import java.util.List;\nimport java.util.Objects;\n\n@RestController\n@RequestMapping(\"/api/v2/services\")\npublic class ServiceRegistryController {\n\n    private final ServiceRegistryService serviceRegistryService;\n    private final ReservedServiceRegistry reservedServiceRegistry;\n\n    public ServiceRegistryController(ServiceRegistryService serviceRegistryService,\n                                     ReservedServiceRegistry reservedServiceRegistry) {\n        this.serviceRegistryService = Objects.requireNonNull(serviceRegistryService, \"serviceRegistryService\");\n        this.reservedServiceRegistry = Objects.requireNonNull(reservedServiceRegistry, \"reservedServiceRegistry\");\n    }\n\n    @PostMapping\n    public Response insertService(@RequestBody @Valid ServiceNameRequest serviceNameRequest) {\n        if (reservedServiceRegistry.contains(serviceNameRequest.getServiceName())) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST,\n                    \"Cannot use reserved service name: \" + serviceNameRequest.getServiceName());\n        }\n        // TODO: (minwoo) 실제 db에 중복값이 있는지 체크도 필요함.\n        serviceRegistryService.insertService(serviceNameRequest.getServiceName());\n\n        return SimpleResponse.ok();\n    }\n\n    @GetMapping\n    public List<String> getServiceNames() {\n        return serviceRegistryService.getServiceNames();\n    }\n\n    // TODO: (minwoo) 이게 진짜 필요한지 추후 검토 필요함.\n    @GetMapping(\"/service\")\n    public ResponseEntity<ServiceView> getService(@RequestParam(\"serviceName\") @NotBlank String serviceName) {\n        Service service = serviceRegistryService.getService(serviceName);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/service-module/src/main/java/com/navercorp/pinpoint/service/web/controller/ServiceRegistryController.java#L24-L60","documentation":"The service registry REST controller blocks POST requests whose serviceName matches an entry in reservedServiceRegistry, returning 400 Bad Request via ResponseStatusException. This is a controller-level guard complementing the well-known check inside ServiceRegistryServiceImpl.","triggerScenarios":"POSTing to the service registry endpoint with a JSON body whose serviceName equals a reserved name (e.g. built-in/elastic names held in ReservedServiceRegistry).","commonSituations":"Automation scripts or dashboards attempting to register infrastructure or built-in service names through the API.","solutions":["Use a non-reserved service name in the request body.","Consult the reserved service list configuration and pick a name outside it.","Catch ResponseStatusException / inspect the 400 response reason and surface a clearer validation message to the user before submit."],"exampleFix":"// before\nPOST /services {\"serviceName\": \"RESERVED_NAME\"}\n// after\nPOST /services {\"serviceName\": \"my-custom-service\"}","handlingStrategy":"validation","validationCode":"if (reservedServiceRegistry.contains(requestedName)) { /* reject before POST */ }","typeGuard":null,"tryCatchPattern":"try { response = rest.post(...); } catch (HttpClientErrorException e) { /* inspect body reason 'Cannot use reserved service name' */ }","preventionTips":["Expose the reserved-name list to clients","Validate input in the UI before calling the API"],"tags":["rest-api","reserved-name","http-400"],"backgroundTag":"invalid-argument-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"}