pinpoint-apm/pinpoint · error · IllegalArgumentException

Node key must not be null or empty

Error message

Node key must not be null or empty

What it means

ServerMapHistogramController.newApplication parses a 'nodeKey' string of the form '<applicationName><DELIMITER><serviceTypeName>' into an Application. If the key is null or empty (StringUtils.hasLength fails) it throws IllegalArgumentException before any parsing. It is invoked via nodeApplication/fromApplication/toApplication for every node referenced by a statistics query.

Solutions

  1. Ensure every node key parameter value is non-empty in the form 'appName^serviceTypeName'
  2. Strip empty strings from the lists before sending the request
  3. Check the UI/client is actually setting the selected node key

Example fix

// before
?fromApplicationNames=,app1&fromServiceTypeCodes=1010,1010
// after (filter empties)
String[] names = raw.split(","); List<String> valid = stream.filter(s -> !s.isBlank()).toList();
Defensive patterns

Strategy: validation

Validate before calling

boolean hasNodeKey(String key) {
    return key != null && !key.isBlank();
}
// filter empty entries before building fromApplicationNames/toApplicationNames

Type guard

Optional<String> safeNodeKey(String key) {
    return (key == null || key.isBlank()) ? Optional.empty() : Optional.of(key);
}

Try / catch

try {
    view = api.getNodeHistogramStatistics(nodeKey);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("Node key must not be null or empty")) {
        // skip this node / surface input error
    } else throw e;
}

Prevention

When it happens

Trigger: Calling /serverMapHistogram/statistics endpoints with an empty or missing node key parameter (fromApplicationNames/toApplicationNames entries that are empty strings), so newApplication receives an empty nodeKey.

Common situations: Query strings like fromApplicationNames=,app1 built by joining arrays with empty members; UI state that lost the selected node; API clients omitting required parameters.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/ServerMapHistogramController.java:265


    private Range toRange(RangeForm rangeForm) {
        Range between = Range.between(rangeForm.getFrom(), rangeForm.getTo());
        this.rangeValidator.validate(between);
        return between;
    }

    private SearchOption.Builder searchOptionBuilder() {
        return SearchOption.newBuilder(DEFAULT_MAX_SEARCH_DEPTH);
    }

    private Application getApplication(Service service, ApplicationForm appForm) {
        return applicationValidator.newApplication(service, appForm.getApplicationName(), appForm.getServiceTypeCode(), appForm.getServiceTypeName());
    }

    private Application newApplication(Service service, String nodeKey) {
        if (!StringUtils.hasLength(nodeKey)) {
            throw new IllegalArgumentException("Node key must not be null or empty");
        }
        if (!NODE_KEY_VALIDATION_PATTERN.matcher(nodeKey).matches()) {
            throw new IllegalArgumentException("Invalid node key format: " + nodeKey);
        }
        String[] parts = NODE_DELIMITER_PATTERN.split(nodeKey, 2);
        String applicationName = parts[0];
        String serviceTypeName = parts[1];

        ServiceType serviceType = null;
        if (StringUtils.hasLength(serviceTypeName)) {
            serviceType = registry.findServiceTypeByName(serviceTypeName);
        }
        if (serviceType != null && serviceType.getCode() != ServiceType.UNDEFINED.getCode()) {
            return new Application(service, applicationName, serviceType);
        }
        throw new IllegalArgumentException("Invalid or undefined service type for application: " + nodeKey);
    }

View on GitHub (pinned to 744c3d3075)