{"record":{"id":"593c15cf04d9bba6","repo":"alibaba/spring-ai-alibaba","slug":"missing-params-593c15","errorCode":"MISSING_PARAMS","errorMessage":"serverName","messagePattern":"serverName","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/McpServerController.java","lineNumber":72,"sourceCode":"@RequestMapping(\"/console/v1/mcp-servers\")\npublic class McpServerController {\n\n\tprivate final McpServerService mcpServerService;\n\n\tpublic McpServerController(McpServerService mcpServerService) {\n\t\tthis.mcpServerService = mcpServerService;\n\t}\n\n\t/**\n\t * Creates a new MCP server with the provided configuration.\n\t * @param detail Detailed configuration of the MCP server\n\t * @return Result containing the server code of the newly created MCP server\n\t */\n\t@PostMapping()\n\tpublic Result<String> createMcpServer(@RequestBody McpServerDetail detail) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (StringUtils.isBlank(detail.getName())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"serverName\"));\n\t\t}\n\t\tif (StringUtils.isBlank(detail.getDeployConfig())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"deployConfig\"));\n\t\t}\n\t\tString serverCode = mcpServerService.createMcp(detail);\n\t\treturn Result.success(context.getRequestId(), serverCode);\n\t}\n\n\t/**\n\t * Updates an existing MCP server with new configuration.\n\t * @param detail Updated configuration for the MCP server\n\t * @return Result indicating the success of the update operation\n\t */\n\t@PutMapping()\n\tpublic Result<String> updateMcpServer(@RequestBody McpServerDetail detail) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (StringUtils.isBlank(detail.getName())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"serverName\"));","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/McpServerController.java#L54-L90","documentation":"BizException(MISSING_PARAMS) thrown by McpServerController.createMcpServer when the McpServerDetail body's `name` is blank. An MCP server registration requires a server name before mcpServerService.createMcp generates a server code.","triggerScenarios":"POST to the MCP server endpoint with a body whose `name` property is missing, null, empty, or whitespace-only.","commonSituations":"Form submitted without the server name field; payload built from a config object where the name key is `serverName` locally but `name` on the wire; leading/trailing whitespace name trimmed to blank.","solutions":["Set a non-blank `name` field in the McpServerDetail request body.","Trim and validate the name client-side before POSTing.","Check the JSON key is `name`, matching McpServerDetail.getName()."],"exampleFix":"// before\n{\"deployConfig\": \"{...}\"}\n// after\n{\"name\": \"my-mcp-server\", \"deployConfig\": \"{...}\"}","handlingStrategy":"validation","validationCode":"if (detail == null || detail.getName() == null || detail.getName().isBlank()) {\n    throw new IllegalArgumentException(\"name is required to create an MCP server\");\n}\nawait client.createMcpServer(detail);","typeGuard":"boolean hasServerName(McpServerDetail d) {\n    return d != null && d.getName() != null && !d.getName().isBlank();\n}","tryCatchPattern":"try {\n    Result<String> r = client.createMcpServer(detail);\n} catch (BizException e) {\n    if (\"MISSING_PARAMS\".equals(e.getCode())) {\n        log.error(\"MCP server creation rejected, missing: {}\", e.getMessage());\n    }\n}","preventionTips":["Make the server-name field mandatory in creation forms.","Trim names and reject blank strings before submission.","Ensure the client model serializes the property as `name`."],"tags":["validation","http-api","mcp"],"backgroundTag":"missing-required-argument","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}