{"record":{"id":"1fd6a412510df45c","repo":"pinpoint-apm/pinpoint","slug":"invalid-node-key-format","errorCode":null,"errorMessage":"Invalid node key format: ","messagePattern":"Invalid node key format: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/ServerMapHistogramController.java","lineNumber":268,"sourceCode":"        Range between = Range.between(rangeForm.getFrom(), rangeForm.getTo());\n        this.rangeValidator.validate(between);\n        return between;\n    }\n\n    private SearchOption.Builder searchOptionBuilder() {\n        return SearchOption.newBuilder(DEFAULT_MAX_SEARCH_DEPTH);\n    }\n\n    private Application getApplication(Service service, ApplicationForm appForm) {\n        return applicationValidator.newApplication(service, appForm.getApplicationName(), appForm.getServiceTypeCode(), appForm.getServiceTypeName());\n    }\n\n    private Application newApplication(Service service, String nodeKey) {\n        if (!StringUtils.hasLength(nodeKey)) {\n            throw new IllegalArgumentException(\"Node key must not be null or empty\");\n        }\n        if (!NODE_KEY_VALIDATION_PATTERN.matcher(nodeKey).matches()) {\n            throw new IllegalArgumentException(\"Invalid node key format: \" + nodeKey);\n        }\n        String[] parts = NODE_DELIMITER_PATTERN.split(nodeKey, 2);\n        String applicationName = parts[0];\n        String serviceTypeName = parts[1];\n\n        ServiceType serviceType = null;\n        if (StringUtils.hasLength(serviceTypeName)) {\n            serviceType = registry.findServiceTypeByName(serviceTypeName);\n        }\n        if (serviceType != null && serviceType.getCode() != ServiceType.UNDEFINED.getCode()) {\n            return new Application(service, applicationName, serviceType);\n        }\n        throw new IllegalArgumentException(\"Invalid or undefined service type for application: \" + nodeKey);\n    }\n\n    @GetMapping(value = \"/statistics\", params = {\n            \"fromApplicationNames\", \"fromServiceTypeCodes\", \"toApplicationNames\", \"toServiceTypeCodes\"\n    })","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/applicationmap/controller/ServerMapHistogramController.java#L250-L286","documentation":"ServerMapHistogramController.newApplication validates the nodeKey against NODE_KEY_VALIDATION_PATTERN before splitting it on the node delimiter. Keys that don't match the expected 'applicationName<delimiter>serviceTypeName' shape are rejected with IllegalArgumentException 'Invalid node key format'.","triggerScenarios":"Passing a node key without the delimiter or extra characters, e.g. 'myApp' (missing '^serviceTypeName'), or containing characters disallowed by the validation pattern.","commonSituations":"Manual curl calls to the statistics endpoint building keys by hand, URL-encoded delimiter lost or double-encoded, clients echoing back a display label instead of the raw node key.","solutions":["Send the key exactly as 'applicationName^serviceTypeName' (check NODE_DELIMITER_PATTERN for the exact delimiter)","Use the node key value verbatim from a prior map API response instead of constructing it","Verify URL encoding of the delimiter (^ -> %5E if required) is not corrupting the value"],"exampleFix":"// before\n?fromApplicationNames=myApp&fromServiceTypeCodes=1010  (key passed as \"myApp\")\n// after\nnodeKey = \"myApp^SPRING_BOOT\"; // matches NODE_KEY_VALIDATION_PATTERN","handlingStrategy":"validation","validationCode":"private static final Pattern KEY = Pattern.compile(\"^.+\\\\^.+$\");\nboolean isValidNodeKey(String key) {\n    return key != null && KEY.matcher(key).matches();\n}","typeGuard":"Optional<String> parseNodeKey(String key) {\n    return (key != null && key.matches(\".+\\\\^.+\")) ? Optional.of(key) : Optional.empty();\n}","tryCatchPattern":"try {\n    app = controller.buildApplication(nodeKey);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Invalid node key format\")) {\n        logger.warn(\"Malformed node key: {}\", nodeKey);\n    } else throw e;\n}","preventionTips":["Copy node keys verbatim from server map API responses","Watch delimiter encoding (^) in HTTP clients and proxies","Add a format assertion wherever node keys are constructed"],"tags":["validation","illegal-argument","node-key","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}