{"record":{"id":"8712d39e3890c50b","repo":"pinpoint-apm/pinpoint","slug":"fieldname-too-long-name-length","errorCode":null,"errorMessage":"${fieldName} too long:${name.length()}","messagePattern":"(.+?) too long:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-server/src/main/java/com/navercorp/pinpoint/common/server/applicationmap/statistics/UidPrefix.java","lineNumber":104,"sourceCode":"        return new UidPrefix(serviceUid, applicationNameHash, serviceType, msTimestamp);\n    }\n\n\n    public static int hash(byte[] bytes) {\n        HashCode hashCode = hashFunction.hashBytes(bytes);\n        return hashCode.hashCode();\n    }\n\n    public static String requireNameLength(String name, String fieldName) {\n        return requireNameLength(name, fieldName, KEY_SIZE);\n    }\n\n    public static String requireNameLength(String name, String fieldName, int maxKeySize) {\n        if (name == null) {\n            throw new NullPointerException(fieldName);\n        }\n        if (name.length() > maxKeySize) {\n            throw new IllegalArgumentException(fieldName + \" too long:\" + name.length());\n        }\n        return name;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (o == null || getClass() != o.getClass()) return false;\n\n        UidPrefix uidPrefix = (UidPrefix) o;\n        return serviceUid == uidPrefix.serviceUid && applicationNameHash == uidPrefix.applicationNameHash && serviceType == uidPrefix.serviceType && timestamp == uidPrefix.timestamp;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = serviceUid;\n        result = 31 * result + applicationNameHash;\n        result = 31 * result + serviceType;\n        result = 31 * result + Long.hashCode(timestamp);","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-server/src/main/java/com/navercorp/pinpoint/common/server/applicationmap/statistics/UidPrefix.java#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Shorten the applicationName/serviceName to fit the key size limit (message shows the offending length)","Increase the KEY_SIZE/maxKeySize consistently across writer and reader if long names are required (coordinate schema change)","Validate names at configuration/registration time so over-long names are rejected early","Check the field name in the exception to find which component is too long"],"exampleFix":"// before\nString appName = request.getApplicationName(); // 64+ chars\nUidLinkRowKey key = buildKey(appName);\n// after\nString appName = request.getApplicationName();\nif (appName != null && appName.length() > MAX_KEY_SIZE) {\n    appName = appName.substring(0, MAX_KEY_SIZE); // or reject at registration\n}\nUidLinkRowKey key = buildKey(appName);","handlingStrategy":"validation","validationCode":"boolean fitsKeySize(String name, int maxKeySize) {\n    return name != null && name.length() <= maxKeySize;\n}","typeGuard":"boolean fitsKeySize(String name, int maxKeySize) {\n    return name != null && name.length() <= maxKeySize;\n}","tryCatchPattern":"try {\n    String validated = UidPrefix.requireNameLength(name, \"applicationName\");\n} catch (IllegalArgumentException e) {\n    log.error(\"name too long for UID key: {}\", e.getMessage());\n    throw new BadRequestException(\"applicationName exceeds key size limit\");\n}","preventionTips":["Enforce name-length limits when registering applications/agents or on config load","Truncate or reject over-long names upstream instead of at row-key build time","Keep KEY_SIZE consistent across all services that build or read these keys","Check the exception's field name to know which component exceeded the limit"],"tags":["validation","length-limit","rowkey"],"backgroundTag":"invalid-argument-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}