pinpoint-apm/pinpoint · error · IllegalArgumentException

toApplicationNames and toServiceTypeCodes must have the same

Error message

toApplicationNames and toServiceTypeCodes must have the same number of elements

What it means

MapHistogramController.getResponseTimeHistogramDataV2 pairs toApplicationNames with toServiceTypeCodes element-by-element. A size mismatch means the controller cannot construct the target Application list, so it throws IllegalArgumentException at line 179.

Source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/MapHistogramController.java:179

            List<String> fromApplicationNames,
            @RequestParam(value = "fromServiceTypeCodes", defaultValue = "", required = false)
            List<Short> fromServiceTypeCodes,
            @RequestParam(value = "toApplicationNames", defaultValue = "", required = false)
            List<String> toApplicationNames,
            @RequestParam(value = "toServiceTypeCodes", defaultValue = "", required = false)
            List<Short> toServiceTypeCodes,
            @RequestParam(value = "useStatisticsAgentState", defaultValue = "true", required = false)
            boolean useStatisticsAgentState
    ) {
        final Range range = toRange(rangeForm);
        TimeWindow timeWindow = new TimeWindow(range);

        if (fromApplicationNames.size() != fromServiceTypeCodes.size()) {
            throw new IllegalArgumentException(
                    "fromApplicationNames and fromServiceTypeCodes must have the same number of elements");
        }
        if (toApplicationNames.size() != toServiceTypeCodes.size()) {
            throw new IllegalArgumentException(
                    "toApplicationNames and toServiceTypeCodes must have the same number of elements");
        }

        final Application application = getApplication(appForm);

        final List<Application> fromApplications = toApplications(fromApplicationNames, fromServiceTypeCodes);
        final List<Application> toApplications = toApplications(toApplicationNames, toServiceTypeCodes);
        final ResponseTimeHistogramServiceOption option = new ResponseTimeHistogramServiceOption
                .Builder(application, timeWindow, fromApplications, toApplications)
                .setUseStatisticsAgentState(useStatisticsAgentState)
                .build();

        final NodeHistogramSummary nodeHistogramSummary = responseTimeHistogramService.selectNodeHistogramData(option);

        ServerGroupList serverGroupList = nodeHistogramSummary.getServerGroupList();
        ServerGroupListView serverGroupListView = new ServerGroupListView(serverGroupList, hyperLinkFactory);
        return new NodeHistogramSummaryView(nodeHistogramSummary, timeWindow, serverGroupListView, TimeHistogramView.ResponseTime);
    }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Make toApplicationNames and toServiceTypeCodes the same length, ordered by index
  2. Validate lengths before sending the request
  3. Remove any orphan name without its corresponding type code

Example fix

// before
?toApplicationNames=api,db&toServiceTypeCodes=1010
// after
?toApplicationNames=api,db&toServiceTypeCodes=1010,2100
Defensive patterns

Strategy: validation

Validate before calling

if (toApplicationNames.size() != toServiceTypeCodes.size()) {
    throw new IllegalArgumentException("toApplicationNames/toServiceTypeCodes length mismatch");
}

Try / catch

try {
    return api.getV2ResponseTimeHistogram(names, toNames, toCodes);
} catch (IllegalArgumentException e) {
    logger.warn("Bad request: {}", e.getMessage());
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: Calling the V2 response-time histogram endpoint where toApplicationNames and toServiceTypeCodes request parameters contain different numbers of comma-separated values.

Common situations: Copy-paste errors in query strings, generated clients that omit the last type code, filters edited by hand adding a target app without its type code.

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


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