pinpoint-apm/pinpoint · error · IllegalArgumentException

${fieldName} too long:${name.length()}

Error message

${fieldName} too long:${name.length()}

What it means

UidPrefix.requireNameLength throws an IllegalArgumentException when the name's length exceeds the maximum key size (default KEY_SIZE, or the provided maxKeySize). Pinpoint row-key components must fit a fixed byte budget, so over-long names cannot be safely embedded in the key.

Source

Thrown at commons-server/src/main/java/com/navercorp/pinpoint/common/server/applicationmap/statistics/UidPrefix.java:104

        return new UidPrefix(serviceUid, applicationNameHash, serviceType, msTimestamp);
    }


    public static int hash(byte[] bytes) {
        HashCode hashCode = hashFunction.hashBytes(bytes);
        return hashCode.hashCode();
    }

    public static String requireNameLength(String name, String fieldName) {
        return requireNameLength(name, fieldName, KEY_SIZE);
    }

    public static String requireNameLength(String name, String fieldName, int maxKeySize) {
        if (name == null) {
            throw new NullPointerException(fieldName);
        }
        if (name.length() > maxKeySize) {
            throw new IllegalArgumentException(fieldName + " too long:" + name.length());
        }
        return name;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;

        UidPrefix uidPrefix = (UidPrefix) o;
        return serviceUid == uidPrefix.serviceUid && applicationNameHash == uidPrefix.applicationNameHash && serviceType == uidPrefix.serviceType && timestamp == uidPrefix.timestamp;
    }

    @Override
    public int hashCode() {
        int result = serviceUid;
        result = 31 * result + applicationNameHash;
        result = 31 * result + serviceType;
        result = 31 * result + Long.hashCode(timestamp);

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Shorten the applicationName/serviceName to fit the key size limit (message shows the offending length)
  2. Increase the KEY_SIZE/maxKeySize consistently across writer and reader if long names are required (coordinate schema change)
  3. Validate names at configuration/registration time so over-long names are rejected early
  4. Check the field name in the exception to find which component is too long

Example fix

// before
String appName = request.getApplicationName(); // 64+ chars
UidLinkRowKey key = buildKey(appName);
// after
String appName = request.getApplicationName();
if (appName != null && appName.length() > MAX_KEY_SIZE) {
    appName = appName.substring(0, MAX_KEY_SIZE); // or reject at registration
}
UidLinkRowKey key = buildKey(appName);
Defensive patterns

Strategy: validation

Validate before calling

boolean fitsKeySize(String name, int maxKeySize) {
    return name != null && name.length() <= maxKeySize;
}

Type guard

boolean fitsKeySize(String name, int maxKeySize) {
    return name != null && name.length() <= maxKeySize;
}

Try / catch

try {
    String validated = UidPrefix.requireNameLength(name, "applicationName");
} catch (IllegalArgumentException e) {
    log.error("name too long for UID key: {}", e.getMessage());
    throw new BadRequestException("applicationName exceeds key size limit");
}

Prevention

When it happens

Trigger: Calling requireNameLength with a name longer than maxKeySize — e.g. an applicationName or serviceName exceeding the configured KEY_SIZE — typically via UidLink row-key construction or UidPrefix validation.

Common situations: Very long application names from agent config; service names from Kubernetes/external systems that exceed the limit; KEY_SIZE reduced in config while existing names are longer.

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/8712d39e3890c50b. Report an issue: GitHub.