{"record":{"id":"ad55037e74f64567","repo":"alibaba/nacos","slug":"api-function-disabled","errorCode":"API_FUNCTION_DISABLED","errorMessage":"AI resource import is disabled.","messagePattern":"AI resource import is disabled\\.","errorType":"exception","errorClass":"NacosApiException","httpStatus":501,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/importer/manager/AiResourceImportPluginManager.java","lineNumber":154,"sourceCode":"                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;\n        return result == null ? Collections.emptyMap() : result;\n    }\n    \n    private void requireModuleEnabled() throws NacosException {\n        if (!propertiesSupplier.get().isEnabled()) {\n            throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n                ErrorCode.API_FUNCTION_DISABLED, \"AI resource import is disabled.\");\n        }\n    }\n    \n    private boolean isPluginEnabled(String pluginName) {\n        return PluginStateCheckerHolder.isPluginEnabled(\n            PluginType.AI_RESOURCE_IMPORT.getType(), pluginName);\n    }\n    \n    private boolean supportsResourceType(AiResourceImportServiceBuilder builder,\n        String resourceType) {\n        return StringUtils.isBlank(resourceType)\n            || builder.supportedResourceTypes().contains(resourceType);\n    }\n    \n    private AiResourceImportSourceInfo toSourceInfo(AiResourceImportServiceBuilder builder) {\n        AiResourceImportSourceInfo result = new AiResourceImportSourceInfo();\n        result.setSourceId(builder.pluginName());","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/importer/manager/AiResourceImportPluginManager.java#L136-L172","documentation":"Thrown by AiResourceImportPluginManager.requireModuleEnabled() when the entire AI resource import feature is turned off. It is the first check in resolveBuilder and listSourceInfos, consulting AiResourceImportProperties.isEnabled() (loaded from environment). Mapped to API_FUNCTION_DISABLED with a SERVER_NOT_IMPLEMENTED top-level code, indicating the server does not implement this capability in its current configuration.","triggerScenarios":"Any AI resource import API call (list/search/validate/execute) when propertiesSupplier.get().isEnabled() returns false. Fires before any plugin lookup, so it blocks the whole module.","commonSituations":"A deployment that has not opted into the AI resource import feature; the enable flag (read from environment/config via AiResourceImportProperties.loadFromEnvironment) is unset or explicitly false; a hardened/minimal server image that ships the module disabled by default.","solutions":["Enable the AI resource import feature by setting the corresponding property/environment variable read by AiResourceImportProperties.","Confirm the server build actually includes the ai module and the importer classes.","If the feature must stay off, stop calling the import APIs from the client."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before exposing import features, check the module flag\nif (!aiResourceImportProperties.isEnabled()) {\n    return FeatureGate.disabled(\"AI resource import is not enabled on this server\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.listSources(resourceType);\n} catch (NacosApiException e) {\n    if (ErrorCode.API_FUNCTION_DISABLED.getCode() == e.getDetailErrCode()) {\n        // feature off: hide the import UI rather than retry\n        return FeatureGate.disabledResponse();\n    }\n    throw e;\n}","preventionTips":["Gate the import UI/API client on a feature flag probe (listSources) and hide controls when disabled.","Document the environment property that enables AI resource import for operators.","Do not retry on SERVER_NOT_IMPLEMENTED/API_FUNCTION_DISABLED; it is a configuration state, not a transient fault."],"tags":["ai","importer","feature-flag","disabled","configuration"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}