alibaba/nacos · error · IllegalArgumentException

Endpoint priority must not be negative

Error message

Endpoint priority must not be negative

What it means

Error "Endpoint priority must not be negative" thrown in alibaba/nacos.

Source

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

    /**
     * Return a canonical copy of an Endpoint. Defaults are materialized and metadata keys are sorted.
     *
     * @param endpoint source Endpoint
     * @return canonical Endpoint copy
     * @throws IllegalArgumentException when the Endpoint is invalid
     */
    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));

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Review the input and runtime state for endpoint priority, correct the reported problem, and retry.

When it happens

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

Common situations: An endpoint was declared with a negative priority.


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