pinpoint-apm/pinpoint · warning · ResponseStatusException
Cannot use reserved service name:
Error message
Cannot use reserved service name:
What it means
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.
Source
Thrown at service-module/src/main/java/com/navercorp/pinpoint/service/web/controller/ServiceRegistryController.java:42
import java.util.List;
import java.util.Objects;
@RestController
@RequestMapping("/api/v2/services")
public class ServiceRegistryController {
private final ServiceRegistryService serviceRegistryService;
private final ReservedServiceRegistry reservedServiceRegistry;
public ServiceRegistryController(ServiceRegistryService serviceRegistryService,
ReservedServiceRegistry reservedServiceRegistry) {
this.serviceRegistryService = Objects.requireNonNull(serviceRegistryService, "serviceRegistryService");
this.reservedServiceRegistry = Objects.requireNonNull(reservedServiceRegistry, "reservedServiceRegistry");
}
@PostMapping
public Response insertService(@RequestBody @Valid ServiceNameRequest serviceNameRequest) {
if (reservedServiceRegistry.contains(serviceNameRequest.getServiceName())) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
"Cannot use reserved service name: " + serviceNameRequest.getServiceName());
}
// TODO: (minwoo) 실제 db에 중복값이 있는지 체크도 필요함.
serviceRegistryService.insertService(serviceNameRequest.getServiceName());
return SimpleResponse.ok();
}
@GetMapping
public List<String> getServiceNames() {
return serviceRegistryService.getServiceNames();
}
// TODO: (minwoo) 이게 진짜 필요한지 추후 검토 필요함.
@GetMapping("/service")
public ResponseEntity<ServiceView> getService(@RequestParam("serviceName") @NotBlank String serviceName) {
Service service = serviceRegistryService.getService(serviceName);View on GitHub (pinned to 744c3d3075)
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.
Example fix
// before
POST /services {"serviceName": "RESERVED_NAME"}
// after
POST /services {"serviceName": "my-custom-service"} Defensive patterns
Strategy: validation
Validate before calling
if (reservedServiceRegistry.contains(requestedName)) { /* reject before POST */ } Try / catch
try { response = rest.post(...); } catch (HttpClientErrorException e) { /* inspect body reason 'Cannot use reserved service name' */ } Prevention
- Expose the reserved-name list to clients
- Validate input in the UI before calling the API
When it happens
Trigger: 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).
Common situations: Automation scripts or dashboards attempting to register infrastructure or built-in service names through the API.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Cannot delete reserved service:
- No service type provided.
- Invalid serviceType. ServiceType is required
- User information validation failed to creating user informat
- there is not userId in params to delete user
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/abfb859c5a32faea.
Report an issue: GitHub.