{"record":{"id":"34614489025f2c3e","repo":"pinpoint-apm/pinpoint","slug":"servicetype-code-of-pair-is-duplicated-with-p","errorCode":null,"errorMessage":"ServiceType code of ${pair} is duplicated with ${prev}","messagePattern":"ServiceType code of (.+?) is duplicated with (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/trace/TraceMetadataLoader.java","lineNumber":222,"sourceCode":"    \n    private class ServiceTypeChecker {\n        private final Map<String, Pair<ServiceType>> serviceTypeNameMap = new HashMap<>();\n        private final Map<Short, Pair<ServiceType>> serviceTypeCodeMap = new HashMap<>();\n\n        private void check(ServiceType type, TraceMetadataProvider provider) {\n            Pair<ServiceType> pair = new Pair<>(type, provider);\n            Pair<ServiceType> prev = serviceTypeNameMap.put(type.getName(), pair);\n    \n            if (prev != null) {\n                // TODO change exception type\n                throw new RuntimeException(\"ServiceType name of \" + serviceTypePairToString(pair) + \" is duplicated with \" + serviceTypePairToString(prev));\n            }\n    \n            prev = serviceTypeCodeMap.put(type.getCode(), pair);\n    \n            if (prev != null) {\n                // TODO change exception type\n                throw new RuntimeException(\"ServiceType code of \" + serviceTypePairToString(pair) + \" is duplicated with \" + serviceTypePairToString(prev));\n            }\n\n            if(type.isAlias()){\n                if(!type.isRpcClient()){\n                    throw new RuntimeException(\"ServiceType code of \" + serviceTypePairToString(pair) + \" should be between range of RPC\");\n                }\n                if(type.isRecordStatistics()){\n                    throw new RuntimeException(\"ServiceType code of \" + serviceTypePairToString(pair) + \" can't have ALIAS and RECORD_STATISTICS at the same time\");\n                }\n            }\n        }\n\n        private void logResult() {\n            logger.info(\"Finished loading ServiceType:\");\n\n            List<Pair<ServiceType>> serviceTypes = new ArrayList<>(serviceTypeCodeMap.values());\n            serviceTypes.sort(Comparator.comparingInt(this::getCode));\n","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/trace/TraceMetadataLoader.java#L204-L240","documentation":"Thrown by TraceMetadataLoader.ServiceTypeChecker.check when two TraceMetadataProviders register ServiceTypes with the same numeric code, detected because the second put into serviceTypeCodeMap returns the previously registered pair. Duplicate codes make agent/server type resolution ambiguous, so metadata loading aborts with a RuntimeException. The input at fault is the ServiceType whose code collides; plugin authors must allocate unique ServiceType codes (or fix conflicting registrations) before loading.","triggerScenarios":"Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/trace/TraceMetadataLoader.java:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign a unique code to your custom ServiceType within the plugin-reserved range","Remove or update the conflicting provider jar","Keep a registry of allocated codes across internal plugins"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}