apache/skywalking · error · UnexpectedException
Can't split instance id into 2 parts, {}
Error message
Can't split instance id into 2 parts, {} What it means
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.
Source
Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java:147
* @param serviceId built by {@link ServiceID#buildId(String, boolean)}
* @return service instance id
*/
public static String buildId(String serviceId, String instanceName) {
if (StringUtil.isBlank(instanceName)) {
instanceName = Const.BLANK_ENTITY_NAME;
}
return serviceId
+ Const.ID_CONNECTOR
+ encode(instanceName);
}
/**
* @return service instance id object decoded from {@link #buildId(String, String)} result
*/
public static ServiceInstanceID.InstanceIDDefinition analysisId(String id) {
final String[] strings = id.split(Const.ID_PARSER_SPLIT);
if (strings.length != 2) {
throw new UnexpectedException("Can't split instance id into 2 parts, " + id);
}
return new ServiceInstanceID.InstanceIDDefinition(
strings[0],
decode(strings[1])
);
}
/**
* @return encoded service instance relation id
*/
public static String buildRelationId(ServiceInstanceRelationDefine define) {
return define.sourceId + Const.RELATION_ID_CONNECTOR + define.destId;
}
/**
* @return encoded instance hierarchy relation id
*/
public static String buildInstanceHierarchyRelationId(InstanceHierarchyRelationDefine define) {View on GitHub (pinned to 102af09b4a)
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
Example fix
// before InstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(instanceName); // after String id = IDManager.ServiceInstanceID.buildId(serviceId, instanceName); InstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(id);
Defensive patterns
Strategy: type-guard
Validate before calling
if (id == null || id.split("\\.").length != 2) {
throw new IllegalArgumentException("Not an instance id produced by IDManager.ServiceInstanceID.buildId: " + id);
} Type guard
boolean isInstanceId(String id) {
return id != null && id.split("\\.").length == 2 && id.endsWith(".") == false;
} Try / catch
try {
InstanceIDDefinition def = IDManager.ServiceInstanceID.analysisId(id);
} catch (UnexpectedException e) {
LOGGER.warn("Skipping malformed instance id: {}", id, e);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Can't split service id into 2 parts, {}
- Illegal Service Relation entity id
- Illegal Service Instance Relation entity id
- Can't split endpoint id into 2 parts, {}
- Illegal endpoint Relation entity id, {}
AI-assisted analysis of apache/skywalking@102af09b4a (2026-08-14).
Data as JSON: /api/errors/9ae6440fb7934fcd.
Report an issue: GitHub.