{"record":{"id":"32685876a57fb8e5","repo":"apache/skywalking","slug":"can-t-split-endpoint-id-into-2-parts","errorCode":null,"errorMessage":"Can't split endpoint id into 2 parts, {}","messagePattern":"Can't split endpoint id into 2 parts, (.+?)","errorType":"exception","errorClass":"UnexpectedException","httpStatus":null,"severity":"error","filePath":"oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java","lineNumber":241,"sourceCode":"         * @param serviceId built by {@link ServiceID#buildId(String, boolean)}\n         * @return endpoint id\n         */\n        public static String buildId(String serviceId, String endpointName) {\n            if (StringUtil.isBlank(endpointName)) {\n                endpointName = Const.BLANK_ENTITY_NAME;\n            }\n            return serviceId\n                + Const.ID_CONNECTOR\n                + encode(endpointName);\n        }\n\n        /**\n         * @return Endpoint id object decoded from {@link #buildId(String, String)} result.\n         */\n        public static EndpointIDDefinition analysisId(String id) {\n            final String[] strings = id.split(Const.ID_PARSER_SPLIT);\n            if (strings.length != 2) {\n                throw new UnexpectedException(\"Can't split endpoint id into 2 parts, \" + id);\n            }\n            return new EndpointIDDefinition(\n                strings[0],\n                decode(strings[1])\n            );\n        }\n\n        /**\n         * @return the endpoint relationship string id.\n         */\n        public static String buildRelationId(EndpointRelationDefine define) {\n            return define.sourceServiceId\n                + Const.RELATION_ID_CONNECTOR\n                + encode(define.source)\n                + Const.RELATION_ID_CONNECTOR\n                + define.destServiceId\n                + Const.RELATION_ID_CONNECTOR\n                + encode(define.dest);","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java#L223-L259","documentation":"UnexpectedException thrown by IDManager.EndpointID.analysisId(String) when an endpoint id does not split into exactly 2 parts. Endpoint ids are built by buildId(serviceId, endpointName) as serviceId + '.' + encode(endpointName); analysisId is the strict inverse and includes the failing id in the message to aid diagnosis.","triggerScenarios":"Passing a raw endpoint name (e.g. '/api/users'), an id whose endpoint name was not URL-encoded so its own separators break the split, an id with extra segments, or null into analysisId.","commonSituations":"Endpoint names are URLs and naturally contain '.' — any producer skipping encode() produces unparseable ids; custom log/LAL or MAL rules constructing endpoint ids manually; tests with hand-made ids; data from versions with different encoding.","solutions":["Create ids only with IDManager.EndpointID.buildId(serviceId, endpointName) (it URL-encodes the name) and decode only its output","Audit custom analyzers for manual string concatenation of serviceId + '.' + endpointName and replace with buildId","Use the id embedded in the exception message to trace the offending producer","For stored bad ids, reindex or drop the affected endpoint rows"],"exampleFix":"// before\nString id = serviceId + \".\" + endpointName; // '/api/v1.users' breaks the split\nEndpointIDDefinition def = IDManager.EndpointID.analysisId(id);\n\n// after\nString id = IDManager.EndpointID.buildId(serviceId, endpointName);\nEndpointIDDefinition def = IDManager.EndpointID.analysisId(id);","handlingStrategy":"type-guard","validationCode":"if (id == null || id.split(\"\\\\.\").length != 2) {\n    throw new IllegalArgumentException(\"Not an endpoint id produced by IDManager.EndpointID.buildId: \" + id);\n}","typeGuard":"boolean isEndpointId(String id) {\n    return id != null && id.split(\"\\\\.\").length == 2;\n}","tryCatchPattern":"try {\n    EndpointIDDefinition def = IDManager.EndpointID.analysisId(id);\n} catch (UnexpectedException e) {\n    LOGGER.warn(\"Skipping malformed endpoint id: {}\", id, e);\n}","preventionTips":["Endpoint names are URL-like and contain '.'; always rely on buildId's encoding instead of manual concat","In LAL/MAL or custom fetchers, resolve endpoint ids through IDManager only","When upgrading OAP across encoding changes, reindex stored endpoint rows before enabling queries"],"tags":["id-management","data-corruption","parsing","oap-server"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}