{"record":{"id":"9ae6440fb7934fcd","repo":"apache/skywalking","slug":"can-t-split-instance-id-into-2-parts","errorCode":null,"errorMessage":"Can't split instance id into 2 parts, {}","messagePattern":"Can't split instance 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":147,"sourceCode":"         * @param serviceId built by {@link ServiceID#buildId(String, boolean)}\n         * @return service instance id\n         */\n        public static String buildId(String serviceId, String instanceName) {\n            if (StringUtil.isBlank(instanceName)) {\n                instanceName = Const.BLANK_ENTITY_NAME;\n            }\n            return serviceId\n                + Const.ID_CONNECTOR\n                + encode(instanceName);\n        }\n\n        /**\n         * @return service instance id object decoded from {@link #buildId(String, String)} result\n         */\n        public static ServiceInstanceID.InstanceIDDefinition 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 instance id into 2 parts, \" + id);\n            }\n            return new ServiceInstanceID.InstanceIDDefinition(\n                strings[0],\n                decode(strings[1])\n            );\n        }\n\n        /**\n         * @return encoded service instance relation id\n         */\n        public static String buildRelationId(ServiceInstanceRelationDefine define) {\n            return define.sourceId + Const.RELATION_ID_CONNECTOR + define.destId;\n        }\n\n        /**\n         * @return encoded instance hierarchy relation id\n         */\n        public static String buildInstanceHierarchyRelationId(InstanceHierarchyRelationDefine define) {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java#L129-L165","documentation":"UnexpectedException thrown by IDManager.ServiceInstanceID.analysisId(String) when an instance id does not split into exactly 2 parts by Const.ID_PARSER_SPLIT. Instance ids are produced by buildId(serviceId, instanceName) as serviceId + '.' + encode(instanceName); analysisId inverts this and rejects any other shape, echoing the bad id in the message.","triggerScenarios":"Passing a raw instance name, an id where the instance name was not URL-encoded (so embedded separators shift the split), an id carrying extra segments, or null/empty into analysisId.","commonSituations":"Custom receiver/analysis code assembling instance ids by string concatenation instead of buildId; names containing the connector character '.' unencoded; stale data from an older encoding scheme after upgrade.","solutions":["Build ids exclusively via IDManager.ServiceInstanceID.buildId(serviceId, instanceName) and pass only its output to analysisId","Verify instance names are URL-encoded on the build side (buildId already does this)","Inspect the failing id in the exception message to find the producing code path","For legacy stored ids, reindex or decode with the historical format"],"exampleFix":"// before\nInstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(instanceName);\n\n// after\nString id = IDManager.ServiceInstanceID.buildId(serviceId, instanceName);\nInstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(id);","handlingStrategy":"type-guard","validationCode":"if (id == null || id.split(\"\\\\.\").length != 2) {\n    throw new IllegalArgumentException(\"Not an instance id produced by IDManager.ServiceInstanceID.buildId: \" + id);\n}","typeGuard":"boolean isInstanceId(String id) {\n    return id != null && id.split(\"\\\\.\").length == 2 && id.endsWith(\".\") == false;\n}","tryCatchPattern":"try {\n    InstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(id);\n} catch (UnexpectedException e) {\n    LOGGER.warn(\"Skipping malformed instance id: {}\", id, e);\n}","preventionTips":["Always use buildId(serviceId, instanceName) — it URL-encodes names containing the separator","Never concatenate serviceId + '.' + name manually in receivers or LAL/MAL scripts","Pin OAP versions between producer and consumer of ids during rolling upgrades"],"tags":["id-management","data-corruption","parsing","oap-server"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}