pinpoint-apm/pinpoint · warning · ResponseStatusException

Invalid serviceType. ServiceType is required

Error message

Invalid serviceType. ServiceType is required

What it means

This Pinpoint Web API endpoint /getAgentList (active agents) rejects the request with HTTP 400 when the resolved ServiceType equals ServiceType.UNDEFINED, meaning neither a valid serviceTypeCode nor serviceTypeName query parameter was supplied or resolvable. The controller requires the caller to explicitly identify the application's service type before listing agents.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/AgentV2Controller.java:82

        this.rangeValidator = new ForwardRangeValidator(Duration.ofDays(configProperties.getInspectorPeriodMax()));
    }

    @PreAuthorize("@naverPermissionEvaluator.hasInspectorPermission(#serviceName.getName(), #applicationName)")
    @GetMapping(value = "/agents", params = {"applicationName", "from", "to"})
    public List<AgentIdView> getAgents(
            @ServiceParam ServiceName serviceName,
            @RequestParam("applicationName") @NotBlank String applicationName,
            @RequestParam(value = "serviceTypeCode", required = false) Integer serviceTypeCode,
            @RequestParam(value = "serviceTypeName", required = false) String serviceTypeName,
            @RequestParam("from") Timestamp from,
            @RequestParam("to") Timestamp to) {
        final Service service = serviceModelResolver.getService(serviceName.getName());
        final ServiceType serviceType = findServiceType(serviceTypeCode, serviceTypeName);
        Range range = Range.between(from, to);
        rangeValidator.validate(range);

        if (serviceType.equals(ServiceType.UNDEFINED)) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid serviceType. ServiceType is required");
        }
        return agentListV2Service.getActiveAgentList(service, applicationName, serviceType, range).stream()
                .map(entry -> AgentIdView.of(entry, range.getTo()))
                .toList();
    }

    @PreAuthorize("@naverPermissionEvaluator.hasInspectorPermission(#serviceName.getName(), #applicationName)")
    @GetMapping(value = "/agents", params = {"applicationName", "!from", "!to"})
    public List<AgentIdView> getAgents(
            @ServiceParam ServiceName serviceName,
            @RequestParam("applicationName") @NotBlank String applicationName,
            @RequestParam(value = "serviceTypeCode", required = false) Integer serviceTypeCode,
            @RequestParam(value = "serviceTypeName", required = false) String serviceTypeName) {
        final Service service = serviceModelResolver.getService(serviceName.getName());
        final ServiceType serviceType = findServiceType(serviceTypeCode, serviceTypeName);
        if (serviceType.equals(ServiceType.UNDEFINED)) {
            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid serviceType. ServiceType is required");
        }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Pass a valid serviceTypeName (e.g. TOMCAT, SPRING_BOOT) or serviceTypeCode query parameter to /getAgentList
  2. Check the serviceTypeName spelling against Pinpoint's service-type registry (service-types.yml / ServiceTypeRegistryService)
  3. If the code is unknown, omit serviceTypeCode and provide serviceTypeName instead, or look up the code in the Pinpoint service type list

Example fix

// before
curl 'http://pinpoint:8080/getAgentList?applicationName=myApp&from=...&to=...'
// after
curl 'http://pinpoint:8080/getAgentList?applicationName=myApp&serviceTypeName=TOMCAT&from=...&to=...'
Defensive patterns

Strategy: validation

Validate before calling

if (serviceTypeCode == null && (serviceTypeName == null || serviceTypeName.isBlank())) { throw new IllegalArgumentException("serviceTypeCode or serviceTypeName is required"); }

Try / catch

try { ... } catch (ResponseStatusException e) { if (e.getStatusCode() == HttpStatus.BAD_REQUEST) { /* prompt for serviceType param */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling GET /getAgentList without serviceTypeCode/serviceTypeName params, or passing a serviceTypeName that findServiceType cannot resolve, so findServiceType returns ServiceType.UNDEFINED.

Common situations: Older dashboards/scripts calling the v2 agent-list API before the serviceType params became mandatory; typos in serviceTypeName; code copied from API versions where the parameter was optional.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/1785f43a754a12ab. Report an issue: GitHub.