{"record":{"id":"ba05ff327e558c95","repo":"apache/skywalking","slug":"illegal-endpoint-relation-entity-id","errorCode":null,"errorMessage":"Illegal endpoint Relation entity id, {}","messagePattern":"Illegal endpoint Relation entity id, (.+?)","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":268,"sourceCode":"         * @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);\n        }\n\n        /**\n         * @return endpoint relation ID object decoded from {@link #buildRelationId(EndpointRelationDefine)} result\n         */\n        public static EndpointRelationDefine analysisRelationId(String entityId) {\n            String[] parts = entityId.split(Const.RELATION_ID_PARSER_SPLIT);\n            if (parts.length != 4) {\n                throw new UnexpectedException(\"Illegal endpoint Relation entity id, \" + entityId);\n            }\n            return new EndpointRelationDefine(\n                parts[0],\n                decode(parts[1]),\n                parts[2],\n                decode(parts[3])\n            );\n        }\n\n        @RequiredArgsConstructor\n        @Getter\n        public static class EndpointIDDefinition {\n            /**\n             * Built by {@link ServiceID#buildId(String, boolean)}\n             */\n            private final String serviceId;\n            private final String endpointName;\n        }","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/IDManager.java#L250-L286","documentation":"UnexpectedException thrown by IDManager.EndpointID.analysisRelationId(String) when an endpoint-relation entity id does not split into exactly 4 parts by Const.RELATION_ID_PARSER_SPLIT. The format from buildRelationId is sourceServiceId + '.' + encode(sourceEndpoint) + '.' + destServiceId + '.' + encode(destEndpoint); the decoder demands exactly four components and includes the bad id in the message.","triggerScenarios":"Passing a 2-segment relation id (service-level or instance-level relation) into the endpoint parser; endpoint names not URL-encoded by the producer so embedded separators change the segment count; truncated or corrupted entity ids from storage; null input.","commonSituations":"Polymorphic handling of relation ids in query/aggregation code that routes all relations to one parser; custom fetchers or exporters re-building relation ids; upgrades where encoding of endpoint names changed, leaving legacy 3- or 5-segment rows.","solutions":["Ensure only ids from EndpointID.buildRelationId(EndpointRelationDefine) reach this method; route service/instance relation ids to their own analysisRelationId variants","Verify both endpoint names went through encode() when the id was written","Inspect the failing id from the message and count segments to identify the producer","Clean or reindex malformed stored relation rows"],"exampleFix":"// before (wrong parser for a service relation id)\nEndpointID.analysisRelationId(serviceRelationEntityId); // 2 parts -> throws\n\n// after\nServiceID.analysisRelationId(serviceRelationEntityId); // 2-part parser\nEndpointID.analysisRelationId(endpointRelationEntityId); // 4-part parser","handlingStrategy":"type-guard","validationCode":"int parts = entityId == null ? 0 : entityId.split(\"\\\\.\").length;\nif (parts != 4) {\n    throw new IllegalArgumentException(\"Not an endpoint-relation id (expected 4 parts, got \" + parts + \"): \" + entityId);\n}","typeGuard":"boolean isEndpointRelationId(String id) {\n    return id != null && id.split(\"\\\\.\").length == 4;\n}","tryCatchPattern":"try {\n    EndpointRelationDefine def = IDManager.EndpointID.analysisRelationId(entityId);\n} catch (UnexpectedException e) {\n    LOGGER.warn(\"Dropping malformed endpoint relation id: {}\", entityId, e);\n}","preventionTips":["Dispatch relation ids to the parser matching their arity (2 = service/instance/process, 4 = endpoint)","Only decode ids produced by the matching buildRelationId in the same OAP version","Log and count malformed ids in ingestion — a spike indicates a misbehaving producer, not random corruption"],"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"}