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
ServerMapHistogramController.getNodeHistogramData pairs toApplicationNames with toServiceTypeCodes for target applications. When the lists differ in length it throws IllegalArgumentException at line 313, refusing to build a partial application list.
Source
Thrown at web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/ServerMapHistogramController.java:313
@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);
ServerGroupList serverGroupList = nodeHistogramSummary.getServerGroupList();
ServerGroupListView serverGroupListView = new ServerGroupListView(serverGroupList, hyperLinkFactory);
return new NodeHistogramSummaryView(nodeHistogramSummary, timeWindow, serverGroupListView, TimeHistogramView.TimeseriesHistogram);View on GitHub (pinned to 744c3d3075)
Solutions
- Ensure toApplicationNames and toServiceTypeCodes have identical, index-aligned lengths
- Strip empty entries from both lists before sending
- Fix the client code that constructs these parameters to always append both values together
Example fix
// before ?toApplicationNames=svc1,svc2&toServiceTypeCodes=1210 // after ?toApplicationNames=svc1,svc2&toServiceTypeCodes=1210,1010
Defensive patterns
Strategy: validation
Validate before calling
if (toApplicationNames.size() != toServiceTypeCodes.size()) {
throw new IllegalArgumentException("to 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
- Append name and code together when building destination lists
- Reject incomplete pairs at input time rather than sending partial requests
- Regenerate parameters from authoritative map responses instead of editing query strings manually
When it happens
Trigger: Calling the /serverMapHistogram/statistics endpoint where toApplicationNames and toServiceTypeCodes contain different numbers of comma-separated values.
Common situations: Hand-edited query strings adding a destination app without its type code, generated clients deserializing an empty code entry, filters saved from an older UI schema.
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
- fromApplicationNames and fromServiceTypeCodes must have the
- not found
- is directory
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/165c772353a45035.
Report an issue: GitHub.