{"record":{"id":"6c06fdd885f4a326","repo":"alibaba/nacos","slug":"url-is-blank","errorCode":null,"errorMessage":"URL is blank","messagePattern":"URL is blank","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/McpExternalDataAdaptor.java","lineNumber":141,"sourceCode":"            throw new IllegalArgumentException(\"Unsupported import type: \" + externalDataTypeEnum);\n        }\n    }\n    \n    /**\n     * Fetch one official MCP registry page and adapt it to Nacos MCP server detail info.\n     *\n     * @param urlData registry endpoint\n     * @param cursor page cursor\n     * @param limit page size\n     * @param search search keyword\n     * @return adapted page result\n     * @throws Exception if registry fetch or adaptation failed\n     */\n    public UrlPageResult fetchOfficialRegistryPage(String urlData, String cursor, Integer limit,\n        String search)\n        throws Exception {\n        if (StringUtils.isBlank(urlData)) {\n            throw new IllegalArgumentException(\"URL is blank\");\n        }\n        return fetchUrlPage(urlData.trim(), cursor, limit, search);\n    }\n    \n    /**\n     * Fetch one official MCP registry server by name or generated id.\n     *\n     * @param urlData registry endpoint\n     * @param externalId selected server name or generated id\n     * @param limit search page size\n     * @return adapted MCP server detail\n     * @throws Exception if registry fetch or adaptation failed\n     */\n    public McpServerDetailInfo fetchOfficialRegistryServer(String urlData, String externalId,\n        int limit) throws Exception {\n        if (StringUtils.isBlank(externalId)) {\n            throw new IllegalArgumentException(\"MCP server external id is blank\");\n        }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/McpExternalDataAdaptor.java#L123-L159","documentation":"Thrown by McpExternalDataAdaptor.fetchOfficialRegistryPage when the supplied registry URL is blank. The method is the entry point for fetching one page from the official MCP registry and requires a non-empty URL. It is an IllegalArgumentException.","triggerScenarios":"Calling fetchOfficialRegistryPage(urlData, ...) with a null, empty, or whitespace-only urlData string.","commonSituations":"Configuration missing the registry base URL; environment variable for the registry endpoint not set; caller passes a placeholder that was never replaced.","solutions":["Supply a non-blank registry base URL (e.g. the official MCP registry endpoint).","Read the URL from a validated config property and fail fast at startup if blank.","Guard the call with a StringUtils.isNotBlank(urlData) check and a clear config error."],"exampleFix":"// before\nadaptor.fetchOfficialRegistryPage(\"\", cursor, 30, null); // blank -> error\n\n// after\nString registry = requireNonBlank(config.getRegistryUrl(), \"registryUrl\");\nadaptor.fetchOfficialRegistryPage(registry, cursor, 30, null);","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(urlData)) { throw new IllegalArgumentException(\"registry URL is required\"); }","typeGuard":"boolean hasRegistryUrl(String u) { return u != null && !u.trim().isEmpty(); }","tryCatchPattern":"try { adaptor.fetchOfficialRegistryPage(url, c, l, s); }\ncatch (IllegalArgumentException e) { reportMissingConfig(\"registryUrl\"); }","preventionTips":["Load and validate the registry URL from config at startup.","Never pass a placeholder/empty string to the fetch method."],"tags":["mcp","registry","import","validation","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}