pinpoint-apm/pinpoint · error · RuntimeException

ServiceType code of ${pair} should be between range of RPC

Error message

ServiceType code of ${pair} should be between range of RPC

What it means

Thrown by TraceMetadataLoader.ServiceTypeChecker.check when a registered ServiceType's code falls outside the valid RPC code range defined by the ServiceType schema (ServiceTypeProperty/ServiceTypeRange rules). It fires during TraceMetadataProvider validation when a provider declares a code that violates the reserved ranges, preventing ambiguous or invalid type codes from entering the system. The input at fault is the ServiceType's numeric code; use the designated range (e.g., ServiceTypeFactory/RPC range constants) when defining custom types.

Source

Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/trace/TraceMetadataLoader.java:227

        private void check(ServiceType type, TraceMetadataProvider provider) {
            Pair<ServiceType> pair = new Pair<>(type, provider);
            Pair<ServiceType> prev = serviceTypeNameMap.put(type.getName(), pair);
    
            if (prev != null) {
                // TODO change exception type
                throw new RuntimeException("ServiceType name of " + serviceTypePairToString(pair) + " is duplicated with " + serviceTypePairToString(prev));
            }
    
            prev = serviceTypeCodeMap.put(type.getCode(), pair);
    
            if (prev != null) {
                // TODO change exception type
                throw new RuntimeException("ServiceType code of " + serviceTypePairToString(pair) + " is duplicated with " + serviceTypePairToString(prev));
            }

            if(type.isAlias()){
                if(!type.isRpcClient()){
                    throw new RuntimeException("ServiceType code of " + serviceTypePairToString(pair) + " should be between range of RPC");
                }
                if(type.isRecordStatistics()){
                    throw new RuntimeException("ServiceType code of " + serviceTypePairToString(pair) + " can't have ALIAS and RECORD_STATISTICS at the same time");
                }
            }
        }

        private void logResult() {
            logger.info("Finished loading ServiceType:");

            List<Pair<ServiceType>> serviceTypes = new ArrayList<>(serviceTypeCodeMap.values());
            serviceTypes.sort(Comparator.comparingInt(this::getCode));

            for (Pair<ServiceType> serviceType : serviceTypes) {
                logger.info(serviceTypePairToString(serviceType));
            }
        }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Move the plugin's ServiceType code outside the RPC reserved range
  2. Use the documented plugin code allocation ranges when defining new types
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/trace/TraceMetadataLoader.java:227 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/ab9b75e404f92463. Report an issue: GitHub.