{"record":{"id":"ac80ce1b012de1bd","repo":"alibaba/nacos","slug":"invalid-param-ac80ce","errorCode":"INVALID_PARAM","errorMessage":"`namespaceId`, `groupName`, `serviceName` should be in remoteServerConfig data if type is `REF`","messagePattern":"`namespaceId`, `groupName`, `serviceName` should be in remoteServerConfig data if type is `REF`","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/McpEndpointOperationService.java","lineNumber":86,"sourceCode":"     *\n     * @param namespaceId           namespace id of mcp server\n     * @param mcpName               name of mcp server\n     * @param endpointSpecification mcp server endpoint specification, see {@link McpEndpointSpec}\n     * @param overrideExisting       if replace all the instances when update the mcp server\n     * @return {@link Service}\n     * @throws NacosException any exception during handling\n     */\n    public Service createMcpServerEndpointServiceIfNecessary(String namespaceId, String mcpName,\n        String version,\n        McpEndpointSpec endpointSpecification, boolean overrideExisting) throws NacosException {\n        if (AiConstants.Mcp.MCP_ENDPOINT_TYPE_REF\n            .equalsIgnoreCase(endpointSpecification.getType())) {\n            Map<String, String> endpointServiceData = endpointSpecification.getData();\n            if (!endpointServiceData.containsKey(CommonParams.NAMESPACE_ID)\n                || !endpointServiceData.containsKey(\n                    CommonParams.GROUP_NAME)\n                || !endpointServiceData.containsKey(CommonParams.SERVICE_NAME)) {\n                throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                    ErrorCode.PARAMETER_MISSING,\n                    \"`namespaceId`, `groupName`, `serviceName` should be in remoteServerConfig data if type is `REF`\");\n            }\n            String refGroupName = endpointSpecification.getData().get(CommonParams.GROUP_NAME);\n            String refServiceName = endpointSpecification.getData().get(CommonParams.SERVICE_NAME);\n            return Service.newService(namespaceId, refGroupName, refServiceName);\n        }\n        String versionMcpName = mcpName + \"::\" + version;\n        Service service = generateService(namespaceId, versionMcpName);\n        if (isNotExist(service)) {\n            doCreateNewService(service);\n            doUpdateInstanceInfo(service, endpointSpecification, namespaceId, mcpName,\n                overrideExisting, versionMcpName);\n            return service;\n        }\n        doUpdateInstanceInfo(service, endpointSpecification, namespaceId, mcpName, overrideExisting,\n            versionMcpName);\n        return service;","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/McpEndpointOperationService.java#L68-L104","documentation":"Thrown by McpEndpointOperationService when an MCP server endpoint spec has type REF but the `data` map is missing `namespaceId`, `groupName`, or `serviceName`. A REF endpoint points at an already-existing Nacos naming service, so all three coordinates must be supplied. Returns INVALID_PARAM with PARAMETER_MISSING detail.","triggerScenarios":"Creating/updating an MCP server whose McpEndpointSpec.type is 'REF' while endpointSpecification.getData() omits any of CommonParams.NAMESPACE_ID, GROUP_NAME, or SERVICE_NAME.","commonSituations":"Switching an MCP server from a direct (stdio/http) endpoint to a REF endpoint without filling all reference fields; typo in the data map keys; frontend form submits only partial ref data.","solutions":["When type is REF, put namespaceId, groupName, and serviceName into McpEndpointSpec.data.","Use the exact CommonParams key strings (namespaceId, groupName, serviceName).","Validate the three keys are present client-side before calling createMcpServer/updateMcpServer."],"exampleFix":"// before\nMcpEndpointSpec spec = new McpEndpointSpec();\nspec.setType(\"REF\");\nspec.getData().put(\"groupName\", \"DEFAULT_GROUP\"); // namespaceId/serviceName missing\n\n// after\nMap<String,String> data = spec.getData();\ndata.put(\"namespaceId\", \"public\");\ndata.put(\"groupName\", \"DEFAULT_GROUP\");\ndata.put(\"serviceName\", \"my-mcp-backend\");","handlingStrategy":"validation","validationCode":"if (\"REF\".equalsIgnoreCase(spec.getType())) {\n    Map<String,String> d = spec.getData();\n    if (!d.containsKey(\"namespaceId\") || !d.containsKey(\"groupName\") || !d.containsKey(\"serviceName\")) {\n        throw new IllegalArgumentException(\"REF endpoint needs namespaceId, groupName, serviceName\");\n    }\n}","typeGuard":"boolean isCompleteRef(McpEndpointSpec s) {\n    Map<String,String> d = s.getData();\n    return d != null && d.containsKey(\"namespaceId\") && d.containsKey(\"groupName\") && d.containsKey(\"serviceName\");\n}","tryCatchPattern":"try { operationService.createMcpServer(...); }\ncatch (NacosApiException e) { if (e.getDetailErrCode() == ErrorCode.PARAMETER_MISSING.getCode()) { /* fix ref data */ } }","preventionTips":["When using REF endpoints, fill all three CommonParams keys from a service picker.","Validate ref completeness in the form/controller before reaching the service."],"tags":["mcp","validation","endpoint-ref","parameter-missing"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}