alibaba/nacos · error · IllegalArgumentException

Endpoint weight must be between 0 and 10000

Error message

Endpoint weight must be between 0 and 10000

What it means

Error "Endpoint weight must be between 0 and 10000" thrown in alibaba/nacos.

Solutions

  1. Correct the invalid value for endpoint weight to match the expected format or allowed set, then retry.

When it happens

Trigger: Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java:75 when the library encounters an invalid state.

Common situations: An endpoint weight was set outside the allowed 0-10000 range.


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/d3d3bf32041283a7. Report an issue: GitHub.

Appendix: source

Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java:75

     */
    public static Endpoint canonicalize(Endpoint endpoint) {
        if (endpoint == null) {
            throw new IllegalArgumentException("Endpoint must not be null");
        }
        CanonicalEndpointUri canonicalUri = parseUri(endpoint.getUri());
        AgentValidationUtils.validateTransport(endpoint.getTransport());
        
        Integer priority = endpoint.getPriority();
        if (priority == null) {
            priority = DEFAULT_PRIORITY;
        } else if (priority < 0) {
            throw new IllegalArgumentException("Endpoint priority must not be negative");
        }
        Double weight = endpoint.getWeight();
        if (weight == null) {
            weight = DEFAULT_WEIGHT;
        } else if (weight.isNaN() || weight.isInfinite() || weight < 0D || weight > 10000D) {
            throw new IllegalArgumentException("Endpoint weight must be between 0 and 10000");
        }
        AgentValidationUtils.validateEndpointMetadata(endpoint.getMetadata());
        
        Endpoint result = new Endpoint();
        result.setUri(canonicalUri.getUri());
        result.setTransport(endpoint.getTransport());
        result.setPriority(priority);
        result.setWeight(weight);
        result.setHealthy(endpoint.getHealthy());
        if (endpoint.getMetadata() != null && !endpoint.getMetadata().isEmpty()) {
            Map<String, String> sorted = new TreeMap<String, String>(endpoint.getMetadata());
            result.setMetadata(new LinkedHashMap<String, String>(sorted));
        }
        return result;
    }
    
    /**
     * Canonicalize an Endpoint URI.

View on GitHub (pinned to 9b989acdf1)