pinpoint-apm/pinpoint · error · IllegalArgumentException

fromApplicationNames and fromServiceTypeCodes must have the

Error message

fromApplicationNames and fromServiceTypeCodes must have the same number of elements

What it means

MapHistogramController.getResponseTimeHistogramDataV2 accepts parallel lists of fromApplicationNames and fromServiceTypeCodes and zips them into Application pairs. When the list sizes differ the pairing is impossible, so it throws IllegalArgumentException before any query runs.

Source

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

            ApplicationForm appForm,
            @Valid @ModelAttribute
            RangeForm rangeForm,
            @RequestParam(value = "fromApplicationNames", defaultValue = "", required = false)
            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);

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Ensure every entry in fromApplicationNames has a matching fromServiceTypeCodes entry at the same index
  2. Validate list lengths client-side before issuing the request
  3. If building from user filters, drop incomplete pairs instead of passing them

Example fix

// before
?fromApplicationNames=app1,app2&fromServiceTypeCodes=1010
// after
?fromApplicationNames=app1,app2&fromServiceTypeCodes=1010,1010
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
    return api.getV2ResponseTimeHistogram(names, codes);
} 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 the fromApplicationNames request parameter contains a different number of comma-separated entries than fromServiceTypeCodes.

Common situations: Programmatically built requests appending a name but forgetting the matching type code, filters with duplicated/partial entries, UI clients constructing query strings with mismatched arrays.

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/87db1acda3ea1b13. Report an issue: GitHub.