{"record":{"id":"c208a0256278c2e3","repo":"alibaba/nacos","slug":"api-function-disabled-c208a0","errorCode":"API_FUNCTION_DISABLED","errorMessage":"Nacos AI AgentSpec module and API required both `naming` and `config` module.","messagePattern":"Nacos AI AgentSpec module and API required both `naming` and `config` module\\.","errorType":"http","errorClass":"NacosApiException","httpStatus":501,"severity":"error","filePath":"console/src/main/java/com/alibaba/nacos/console/handler/impl/noop/ai/AgentSpecNoopHandler.java","lineNumber":57,"sourceCode":"import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;\nimport org.springframework.stereotype.Service;\n\n/**\n * Noop implementation of AgentSpec handler.\n * Used when AI module is not enabled or both `naming` and `config` modules are not available.\n *\n * @author nacos\n */\n@Service\n@ConditionalOnMissingBean(value = AgentSpecHandler.class, ignored = AgentSpecNoopHandler.class)\npublic class AgentSpecNoopHandler implements AgentSpecHandler {\n    \n    private static final String AGENTSPEC_NOT_ENABLED_MESSAGE =\n        \"Nacos AI AgentSpec module and API required both `naming` and `config` module.\";\n    \n    @Override\n    public AgentSpecMeta getAgentSpec(AgentSpecForm form) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            AGENTSPEC_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public AgentSpec getAgentSpecVersion(AgentSpecForm form) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            AGENTSPEC_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public void deleteAgentSpec(AgentSpecForm form) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            AGENTSPEC_NOT_ENABLED_MESSAGE);\n    }\n    ","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console/src/main/java/com/alibaba/nacos/console/handler/impl/noop/ai/AgentSpecNoopHandler.java#L39-L75","documentation":"Thrown by AgentSpecNoopHandler.getAgentSpec when retrieving agent-spec metadata. The noop handler is the active AgentSpecHandler bean (@ConditionalOnMissingBean) when the deployment lacks both the naming and config modules required by the AI AgentSpec feature, so it raises NacosApiException with NacosException.SERVER_NOT_IMPLEMENTED (HTTP 501) and ErrorCode.API_FUNCTION_DISABLED.","triggerScenarios":"Calling the AgentSpec get API on a Nacos server build that does not bundle the real AgentSpecHandler (missing naming or config module).","commonSituations":"Custom/slim Nacos distribution without the AI AgentSpec module; calling AgentSpec endpoints before enabling the feature.","solutions":["Deploy Nacos with both naming and config modules to activate the real AgentSpecHandler.","Do not call AgentSpec APIs on deployments that intentionally exclude the feature.","Detect the noop handler at startup and disable AgentSpec flows in your client."],"exampleFix":"// before\nAgentSpecMeta m = agentSpecHandler.getAgentSpec(form); // -> 501\n\n// after\nif (agentSpecHandler instanceof AgentSpecNoopHandler) {\n    throw new IllegalStateException(\"AgentSpec requires naming+config modules; enable them first\");\n}\nAgentSpecMeta m = agentSpecHandler.getAgentSpec(form);","handlingStrategy":"validation","validationCode":"// Feature-detect: only call AgentSpec get when the real handler is present\nif (agentSpecHandler instanceof AgentSpecNoopHandler) {\n    throw new ServiceException(\"AgentSpec feature not enabled (requires naming+config modules)\");\n}\nreturn agentSpecHandler.getAgentSpec(form);","typeGuard":"// Java: boolean guard for AgentSpec availability\nboolean agentSpecEnabled = !(agentSpecHandler instanceof AgentSpecNoopHandler);","tryCatchPattern":"try {\n    return agentSpecHandler.getAgentSpec(form);\n} catch (NacosApiException e) {\n    if (e.getDetailErrCode() == ErrorCode.API_FUNCTION_DISABLED.getCode()) {\n        // feature not deployed; skip or surface message\n    } else { throw e; }\n}","preventionTips":["Probe the handler type at startup and disable AgentSpec flows when noop is active.","Deploy naming+config modules together to enable the real AgentSpecHandler.","Document which Nacos distributions include the AgentSpec feature."],"tags":["ai","agentspec","feature-disabled","deployment","agent"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}