{"record":{"id":"a16bf2e6cf838162","repo":"alibaba/nacos","slug":"parameter-missing-a16bf2","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter `mcpName` not present","messagePattern":"Required parameter `mcpName` not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/ai/NacosAiService.java","lineNumber":189,"sourceCode":"    \n    private void start() throws NacosException {\n        this.grpcClient.start(this.mcpServerCacheHolder, this.agentCardCacheHolder);\n        NotifyCenter.registerToPublisher(McpServerChangedEvent.class, 16384);\n        NotifyCenter.registerToPublisher(PromptChangedEvent.class, 16384);\n        NotifyCenter.registerToPublisher(AgentSpecChangedEvent.class, 16384);\n        NotifyCenter.registerToPublisher(SkillChangedEvent.class, 16384);\n        NotifyCenter.registerSubscriber(this.aiChangeNotifier);\n    }\n    \n    @Override\n    public AgentVersionDetail publishAgent(AgentPublishRequest request) throws NacosException {\n        return aiClientProxy.publishAgent(AgentModelUtils.copyPublishRequest(request));\n    }\n    \n    @Override\n    public McpServerDetailInfo getMcpServer(String mcpName, String version) throws NacosException {\n        if (StringUtils.isBlank(mcpName)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter `mcpName` not present\");\n        }\n        return grpcClient.queryMcpServer(mcpName, version);\n    }\n    \n    @Override\n    public String releaseMcpServer(McpServerBasicInfo serverSpecification,\n        McpToolSpecification toolSpecification,\n        McpEndpointSpec endpointSpecification) throws NacosException {\n        return releaseMcpServer(serverSpecification, toolSpecification, null,\n            endpointSpecification);\n    }\n    \n    @Override\n    public String releaseMcpServer(McpServerBasicInfo serverSpecification,\n        McpToolSpecification toolSpecification,\n        McpResourceSpecification resourceSpecification, McpEndpointSpec endpointSpecification)\n        throws NacosException {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/ai/NacosAiService.java#L171-L207","documentation":"The `getMcpServer(String mcpName, String version)` query guard rejects a blank `mcpName` before issuing the gRPC `queryMcpServer` call. Thrown as NacosApiException with errCode=NacosException.INVALID_PARAM (400) and detailErrCode=ErrorCode.PARAMETER_MISSING (10000). It is a synchronous client-side pre-flight guard in NacosAiService: no network call is ever made. `version` is optional (null/blank = latest), but `mcpName` is mandatory.","triggerScenarios":"Calling aiService.getMcpServer(null, v), getMcpServer(\"\", v), or getMcpServer(\"   \", v). Also triggered by the 1-arg convenience default getMcpServer(name) that forwards a null name.","commonSituations":"mcpName sourced from an unset config/env var, an empty CLI arg, or a downstream lookup (e.g. a registry search) that returned null/empty and was forwarded unchecked.","solutions":["Supply a non-blank mcpName (the MCP server's registered name).","Guard with StringUtils.isNotBlank(mcpName) before the call and degrade/log when blank.","Fix the upstream source of the value (config file / env var / search result) if it is unexpectedly blank."],"exampleFix":"// before\naiService.getMcpServer(mcpName, version);  // mcpName is null/blank\n\n// after\nif (StringUtils.isBlank(mcpName)) {\n    throw new IllegalArgumentException(\"mcpName required\");\n}\nMcpServerDetailInfo info = aiService.getMcpServer(mcpName, version);","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(mcpName)) {\n    LOG.warn(\"Skipping MCP query: mcpName is blank\");\n    return null;\n}\naiService.getMcpServer(mcpName, version);","typeGuard":null,"tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getDetailErrCode() == ErrorCode.PARAMETER_MISSING.getCode()) {\n        // bad caller input — do NOT retry; log and degrade\n        LOG.warn(\"Bad AiService input: {}\", e.getMessage());\n        return;\n    }\n    throw e;\n}","preventionTips":["mcpName is the only required arg for getMcpServer; version may be null for latest.","Check the variable's source (config/env) when it is unexpectedly blank."],"tags":["mcp","validation","client-sdk","ai","parameter-missing"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}