{"record":{"id":"5892417011d11f07","repo":"alibaba/nacos","slug":"api-function-disabled-589241","errorCode":"API_FUNCTION_DISABLED","errorMessage":"Nacos AI A2A module and API required both `naming` and `config` module.","messagePattern":"Nacos AI A2A 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/A2aNoopHandler.java","lineNumber":54,"sourceCode":"\nimport java.util.List;\n\n/**\n * A2a inner handler.\n *\n * @author KiteSoar\n */\n@Component\n@ConditionalOnMissingBean(value = A2aHandler.class, ignored = A2aNoopHandler.class)\npublic class A2aNoopHandler implements A2aHandler {\n    \n    private static final String A2A_NOT_ENABLED_MESSAGE =\n        \"Nacos AI A2A module and API required both `naming` and `config` module.\";\n    \n    @Override\n    public void registerAgent(AgentCard agentCard, AgentCardForm agentCardForm)\n        throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            A2A_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public AgentCardDetailInfo getAgentCardWithVersions(AgentForm form) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            A2A_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public void deleteAgent(AgentForm form) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            A2A_NOT_ENABLED_MESSAGE);\n    }\n    ","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console/src/main/java/com/alibaba/nacos/console/handler/impl/noop/ai/A2aNoopHandler.java#L36-L72","documentation":"Thrown by A2aNoopHandler.registerAgent. This noop handler is the active A2aHandler bean (@ConditionalOnMissingBean) when no real implementation is present, i.e., when the deployment does not include both the naming and config modules needed by the AI A2A feature. It raises NacosApiException with NacosException.SERVER_NOT_IMPLEMENTED (HTTP 501) and ErrorCode.API_FUNCTION_DISABLED.","triggerScenarios":"Calling the A2A register-agent API on a Nacos server build that does not bundle the A2A implementation (missing naming or config module), so the noop handler is wired instead of the real one.","commonSituations":"Running a slim/serverless or custom Nacos distribution without the AI module; enabling AI A2A endpoints before installing both naming and config modules; calling A2A APIs in an environment that intentionally excludes them.","solutions":["Deploy a Nacos build that includes both the naming and config modules so the real A2aHandler bean is loaded.","Do not call A2A endpoints in deployments that intentionally omit the feature.","Verify the active A2aHandler is the real implementation (not A2aNoopHandler) before invoking register operations."],"exampleFix":"// before: calling A2A register on a feature-disabled server\na2aHandler.registerAgent(agentCard, form); // -> 501 API_FUNCTION_DISABLED\n\n// after: gate on feature availability, or enable the module\nif (a2aHandler instanceof A2aNoopHandler) {\n    throw new IllegalStateException(\"A2A requires naming+config modules; enable them first\");\n}\na2aHandler.registerAgent(agentCard, form);","handlingStrategy":"validation","validationCode":"// Feature-detect: only call A2A register if the real handler is present\nif (a2aHandler instanceof A2aNoopHandler) {\n    throw new ServiceException(\"A2A feature not enabled (requires naming+config modules)\");\n}\na2aHandler.registerAgent(agentCard, form);","typeGuard":"// Java: boolean guard for A2A availability\nboolean a2aEnabled = !(a2aHandler instanceof A2aNoopHandler);","tryCatchPattern":"try {\n    a2aHandler.registerAgent(agentCard, form);\n} catch (NacosApiException e) {\n    if (e.getDetailErrCode() == ErrorCode.API_FUNCTION_DISABLED.getCode()) {\n        // A2A not deployed; skip or queue\n    } else { throw e; }\n}","preventionTips":["Probe the handler type at startup and disable A2A UI/flows when noop is active.","Deploy naming+config modules together to enable the real A2aHandler.","Document which Nacos distributions include the A2A feature."],"tags":["ai","a2a","feature-disabled","deployment","agent"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}