{"record":{"id":"d3d3bf32041283a7","repo":"alibaba/nacos","slug":"endpoint-weight-must-be-between-0-and-10000","errorCode":null,"errorMessage":"Endpoint weight must be between 0 and 10000","messagePattern":"Endpoint weight must be between 0 and 10000","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java","lineNumber":75,"sourceCode":"     */\n    public static Endpoint canonicalize(Endpoint endpoint) {\n        if (endpoint == null) {\n            throw new IllegalArgumentException(\"Endpoint must not be null\");\n        }\n        CanonicalEndpointUri canonicalUri = parseUri(endpoint.getUri());\n        AgentValidationUtils.validateTransport(endpoint.getTransport());\n        \n        Integer priority = endpoint.getPriority();\n        if (priority == null) {\n            priority = DEFAULT_PRIORITY;\n        } else if (priority < 0) {\n            throw new IllegalArgumentException(\"Endpoint priority must not be negative\");\n        }\n        Double weight = endpoint.getWeight();\n        if (weight == null) {\n            weight = DEFAULT_WEIGHT;\n        } else if (weight.isNaN() || weight.isInfinite() || weight < 0D || weight > 10000D) {\n            throw new IllegalArgumentException(\"Endpoint weight must be between 0 and 10000\");\n        }\n        AgentValidationUtils.validateEndpointMetadata(endpoint.getMetadata());\n        \n        Endpoint result = new Endpoint();\n        result.setUri(canonicalUri.getUri());\n        result.setTransport(endpoint.getTransport());\n        result.setPriority(priority);\n        result.setWeight(weight);\n        result.setHealthy(endpoint.getHealthy());\n        if (endpoint.getMetadata() != null && !endpoint.getMetadata().isEmpty()) {\n            Map<String, String> sorted = new TreeMap<String, String>(endpoint.getMetadata());\n            result.setMetadata(new LinkedHashMap<String, String>(sorted));\n        }\n        return result;\n    }\n    \n    /**\n     * Canonicalize an Endpoint URI.","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java#L57-L93","documentation":"Error \"Endpoint weight must be between 0 and 10000\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java:75 when the library encounters an invalid state.","commonSituations":"An endpoint weight was set outside the allowed 0-10000 range.","solutions":["Correct the invalid value for endpoint weight to match the expected format or allowed set, then retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}