{"record":{"id":"d1b3660a30d919e4","repo":"alibaba/nacos","slug":"resource-not-found","errorCode":"RESOURCE_NOT_FOUND","errorMessage":"AI resource import plugin not found: {}","messagePattern":"AI resource import plugin not found: (.+?)","errorType":"exception","errorClass":"NacosApiException","httpStatus":404,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/importer/manager/AiResourceImportPluginManager.java","lineNumber":130,"sourceCode":"            result.add(toSourceInfo(each));\n        }\n        return result;\n    }\n    \n    /**\n     * Resolve an enabled managed builder.\n     *\n     * @param pluginName managed plugin name and source id\n     * @param resourceType expected resource type\n     * @return resolved builder\n     * @throws NacosException if routing fails\n     */\n    public AiResourceImportServiceBuilder resolveBuilder(String pluginName, String resourceType)\n        throws NacosException {\n        requireModuleEnabled();\n        AiResourceImportServiceBuilder result = getLoadedPlugins().get(pluginName);\n        if (result == null) {\n            throw new NacosApiException(NacosException.NOT_FOUND,\n                ErrorCode.RESOURCE_NOT_FOUND,\n                \"AI resource import plugin not found: \" + pluginName);\n        }\n        if (!isPluginEnabled(pluginName)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"AI resource import plugin is disabled: \" + pluginName);\n        }\n        if (!supportsResourceType(result, resourceType)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"AI resource import plugin does not support resource type: \" + resourceType);\n        }\n        return result;\n    }\n    \n    private Map<String, AiResourceImportServiceBuilder> getLoadedPlugins() {\n        Map<String, AiResourceImportServiceBuilder> result = builders;","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/importer/manager/AiResourceImportPluginManager.java#L112-L148","documentation":"Thrown by AiResourceImportPluginManager.resolveBuilder() when no loaded AI resource import builder is registered under the requested pluginName (the sourceId). The manager looks up builders discovered via SPI (NacosServiceLoader.load(AiResourceImportServiceBuilder.class)); a miss means the source id does not correspond to any discovered plugin. Mapped to RESOURCE_NOT_FOUND with a NOT_FOUND top-level code.","triggerScenarios":"An import search/validate/execute request whose sourceId does not match any builder.pluginName() in the loaded plugin map. Also fires when the plugin map has not been populated (loadPlugins never triggered) and getLoadedPlugins() returns empty.","commonSituations":"Typo in the sourceId passed by the client; the plugin jar is not on the server classpath or its SPI metadata file is missing under META-INF/services; requesting a source that belongs to a different Nacos deployment; calling import before loadPlugins() has run.","solutions":["Call the list sources endpoint first and use a sourceId returned there (it equals builder.pluginName()).","Verify the expected plugin jar is deployed and its SPI descriptor (META-INF/services/com.alibaba.nacos.plugin.ai.importer.spi.AiResourceImportServiceBuilder) lists the implementation.","Check server startup logs to confirm the builder was discovered by NacosServiceLoader."],"exampleFix":"// before\nrequest.setSourceId(\"mcphub\"); // wrong id\n\n// after: discover valid ids first\nList<AiResourceImportSourceInfo> sources = manager.listSources(null);\nString id = sources.stream().filter(s -> s.getDisplayName().contains(\"MCP Hub\"))\n    .map(AiResourceImportSourceInfo::getSourceId).findFirst().orElseThrow();\nrequest.setSourceId(id);","handlingStrategy":"validation","validationCode":"List<AiResourceImportSourceInfo> sources = pluginManager.listSourceInfos(null);\nSet<String> validIds = sources.stream()\n    .map(AiResourceImportSourceInfo::getSourceId)\n    .collect(Collectors.toSet());\nif (!validIds.contains(request.getSourceId())) {\n    throw new IllegalArgumentException(\n        \"Unknown sourceId '\" + request.getSourceId() + \"'. Valid: \" + validIds);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cache the list of valid sourceIds at startup and refresh when plugins are redeployed.","Do not hard-code sourceIds in client config; resolve them dynamically from listSources.","Confirm the SPI descriptor file (META-INF/services/...AiResourceImportServiceBuilder) is present in the deployed jar."],"tags":["ai","importer","plugin","spi","not-found"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}