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
ServerMapHistogramController.getNodeHistogramData zips fromApplicationNames with fromServiceTypeCodes into source Applications. Mismatched list lengths make pairing impossible, so it throws IllegalArgumentException before querying.
Source
Thrown at web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/ServerMapHistogramController.java:309
@Valid @ModelAttribute
RangeForm rangeForm,
@RequestParam(value = "fromApplicationNames", defaultValue = "", required = false)
List<String> fromApplicationNames,
@RequestParam(value = "fromServiceTypeCodes", defaultValue = "", required = false)
List<Integer> fromServiceTypeCodes,
@RequestParam(value = "toApplicationNames", defaultValue = "", required = false)
List<String> toApplicationNames,
@RequestParam(value = "toServiceTypeCodes", defaultValue = "", required = false)
List<Integer> toServiceTypeCodes,
@RequestParam(value = "useStatisticsAgentState", defaultValue = "true", required = false)
boolean useStatisticsAgentState
) {
final Range range = toRange(rangeForm);
this.rangeValidator.validate(range);
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 Service service = serviceModelResolver.getService(serviceName.getName());
final Application application = getApplication(service, appForm);
final List<Application> fromApplications = toApplications(service, fromApplicationNames, fromServiceTypeCodes);
final List<Application> toApplications = toApplications(service, 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
- Make both lists equal length and index-aligned before sending
- Validate lengths client-side and reject incomplete pairs
- Regenerate the query from a single source of truth (the map response) instead of editing strings
Example fix
// before ?fromApplicationNames=a,b,c&fromServiceTypeCodes=1010,1010 // after ?fromApplicationNames=a,b,c&fromServiceTypeCodes=1010,1010,1010
Defensive patterns
Strategy: validation
Validate before calling
if (fromApplicationNames.size() != fromServiceTypeCodes.size()) {
throw new IllegalArgumentException("from list length mismatch");
} Try / catch
try {
summary = api.getNodeHistogramStatistics(names, codes, toNames, toCodes);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("must have the same number of elements")) {
logger.warn("Dropping request: {}", e.getMessage());
return null;
} throw e;
} Prevention
- Serialize from-pairs from a single List<Application>-like structure
- Validate list lengths in a shared request builder
- Add client-side tests for multi-value parameter construction
When it happens
Trigger: Calling the /serverMapHistogram/statistics endpoint where fromApplicationNames and fromServiceTypeCodes request parameters contain different numbers of comma-separated entries.
Common situations: Scripts appending one list but not the other, UI filters with incomplete from-node entries, retry logic that partially updated query parameters.
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
- fromApplicationNames and fromServiceTypeCodes must have the
- toApplicationNames and toServiceTypeCodes must have the same
- toApplicationNames and toServiceTypeCodes must have the same
- not found
- is directory
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/a096a851cbdb708c.
Report an issue: GitHub.