{"record":{"id":"c541397ce5fd71ed","repo":"alibaba/nacos","slug":"endpoint-must-not-be-null","errorCode":null,"errorMessage":"Endpoint must not be null","messagePattern":"Endpoint must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java","lineNumber":60,"sourceCode":"    private static final int MAX_PORT = 65535;\n    \n    private static final int DEFAULT_PRIORITY = 0;\n    \n    private static final double DEFAULT_WEIGHT = 1D;\n    \n    private EndpointCanonicalizer() {\n    }\n    \n    /**\n     * Return a canonical copy of an Endpoint. Defaults are materialized and metadata keys are sorted.\n     *\n     * @param endpoint source Endpoint\n     * @return canonical Endpoint copy\n     * @throws IllegalArgumentException when the Endpoint is invalid\n     */\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        ","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java#L42-L78","documentation":"Error \"Endpoint must not be null\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/EndpointCanonicalizer.java:60 when the library encounters an invalid state.","commonSituations":"Canonicalizing a null Endpoint object.","solutions":["Provide a non-null value for endpoint null before invoking this operation."],"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"}