apache/skywalking · error · RuntimeException
Illegal Service Instance Relation entity id
Error message
Illegal Service Instance Relation entity id
What it means
RuntimeException thrown by IDManager.ServiceInstanceID.analysisRelationId(String) when a service-instance relation entity id does not split into exactly 2 parts. Valid ids come from buildRelationId as instanceId + RELATION_ID_CONNECTOR + relatedInstanceId; anything with a different segment count is rejected. Note the parallel hierarchy builder (for instance layers) emits 4-segment ids that this method cannot parse.
Source
Thrown at oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java:178
}
/**
* @return encoded instance hierarchy relation id
*/
public static String buildInstanceHierarchyRelationId(InstanceHierarchyRelationDefine define) {
return define.instanceId + Const.SERVICE_ID_CONNECTOR + define.serviceLayer.value() +
Const.RELATION_ID_CONNECTOR +
define.relatedInstanceId + Const.SERVICE_ID_CONNECTOR + define.relatedServiceLayer.value();
}
/**
* @return service instance relation ID object decoded from {@link #buildRelationId(ServiceInstanceRelationDefine)}
* result
*/
public static ServiceInstanceID.ServiceInstanceRelationDefine analysisRelationId(String entityId) {
String[] parts = entityId.split(Const.RELATION_ID_PARSER_SPLIT);
if (parts.length != 2) {
throw new RuntimeException("Illegal Service Instance Relation entity id");
}
return new ServiceInstanceID.ServiceInstanceRelationDefine(parts[0], parts[1]);
}
@RequiredArgsConstructor
@Getter
public static class InstanceIDDefinition {
/**
* Built by {@link ServiceID#buildId(String, boolean)}
*/
private final String serviceId;
private final String name;
}
@RequiredArgsConstructor
@Getter
@EqualsAndHashCode
public static class ServiceInstanceRelationDefine {View on GitHub (pinned to 102af09b4a)
Solutions
- Use ServiceInstanceID.buildRelationId(...) to create ids and only decode its output with analysisRelationId
- Choose a dedicated parser for 4-segment hierarchy ids rather than this method
- Log the offending entityId (it is not in the message — add it at the call site or inspect the argument) and audit its producer
- Add a defensive parts.length check before calling in integration code
Example fix
// before
String[] p = entityId.split("\\.");
IDManager.ServiceInstanceID.analysisRelationId(p[0] + "." + p[1]); // mangled id
// after
ServiceInstanceRelationDefine def =
IDManager.ServiceInstanceID.analysisRelationId(entityId); // pass the id through untouched Defensive patterns
Strategy: type-guard
Validate before calling
if (entityId == null || entityId.split("\\.").length != 2) {
throw new IllegalArgumentException("Not a plain instance-relation id (4 segments means hierarchy format): " + entityId);
} Type guard
boolean isPlainInstanceRelationId(String id) {
return id != null && id.split("\\.").length == 2;
} Try / catch
try {
ServiceInstanceRelationDefine def = IDManager.ServiceInstanceID.analysisRelationId(entityId);
} catch (RuntimeException e) {
LOGGER.warn("Dropping malformed instance relation id: {}", entityId, e);
} Prevention
- Route relation ids by their builder (plain vs hierarchy) — never guess by try/catch alone
- Audit custom query plugins that re-split ids and pass fragments onward
- Capture the entityId in your own logs since this exception omits it
When it happens
Trigger: Feeding a hierarchy-format instance relation id (instance + layer + connector + related instance + layer) into analysisRelationId; hand-built relation strings with wrong connector count; null or empty input; corrupted storage values.
Common situations: New code paths distinguishing layered vs plain instance relations picking the wrong parser; query/GraphQL layer code re-splitting ids manually then passing remnants downstream; data written by a divergent fork.
Related errors
- Can't split service id into 2 parts, {}
- Illegal Service Relation entity id
- Can't split instance id into 2 parts, {}
- 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/5be20a2b8c6773af.
Report an issue: GitHub.