{"record":{"id":"2840991817b69bec","repo":"alibaba/spring-ai-alibaba","slug":"updatemcpservererror","errorCode":"UpdateMCPServerError","errorMessage":"Failed to update MCPServer. fail parse InstallConfig","messagePattern":"Failed to update MCPServer\\. fail parse InstallConfig","errorType":"error_code","errorClass":"BizException","httpStatus":500,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/McpServerServiceImpl.java","lineNumber":161,"sourceCode":"\t\t\tif (!checkResult.isSuccess()) {\n\t\t\t\tthrow new Exception(String.valueOf(checkResult.getMessage()));\n\t\t\t}\n\t\t\tentity.setDeployConfig(checkResult.getData());\n\t\t\tentity.setHost(fetchHost(checkResult.getData()));\n\t\t\tentity.setDetailConfig(detail.getDetailConfig());\n\t\t\tentity.setDescription(detail.getDescription());\n\t\t\tentity.setStatus(detail.getStatus());\n\t\t\tentity.setBizType(detail.getBizType());\n\t\t\tentity.setInstallType(detail.getInstallType());\n\t\t\tentity.setDeployEnv(detail.getDeployEnv());\n\t\t\tentity.setSource(detail.getSource());\n\t\t\tentity.setType(detail.getType() == null ? McpServerTypeEnum.CUSTOMER.name() : detail.getType());\n\t\t\tthis.updateById(entity);\n\t\t\tString key = getMcpCacheKey(context.getWorkspaceId(), serverCode);\n\t\t\tredisManager.put(key, entity);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new BizException(ErrorCode.UPDATE_MCP_ERROR.toError(\"fail parse InstallConfig\"), e);\n\t\t}\n\n\t}\n\n\t/**\n\t * Marks an MCP server as deleted\n\t * @param serverCode Unique identifier of the server\n\t */\n\t@Override\n\tpublic void deleteMcp(String serverCode) {\n\t\ttry {\n\t\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\t\tMcpServerEntity entity = getMcpByCode(context.getWorkspaceId(), serverCode, null);\n\t\t\tif (entity == null) {\n\t\t\t\tthrow new BizException(MCP_NOT_FOUND.toError());\n\t\t\t}\n\t\t\tentity.setGmtModified(new Date());\n\t\t\tentity.setStatus(McpServerStatusEnum.Deleted.getCode());","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/McpServerServiceImpl.java#L143-L179","documentation":"Thrown by McpServerServiceImpl.updateMcp when an exception occurs during the update flow — notably when the new deploy/install config fails to parse via mcpManager.processInstallConfig. The catch-all wraps the original exception as cause.","triggerScenarios":"Calling updateMcp with a deployConfig that is malformed JSON, incompatible with the given installType, or fails processInstallConfig validation; also any other runtime error inside the try block (entity mutation, cache put).","commonSituations":"Changing a server from stdio to sse (or vice versa) without adjusting config fields, pasting truncated/invalid JSON config, Redis cache errors during the put.","solutions":["Read the cause exception in logs to identify whether it is a config parse failure or an infrastructure error.","Ensure deployConfig matches the schema required by the specified installType before updating.","Retry if the failure was transient (e.g. Redis unavailability during cache write)."],"exampleFix":"// before (sse type given stdio config)\n{\"command\": \"npx\", \"args\": [\"-y\", \"server\"]}\n// after (matching installType \"sse\")\n{\"url\": \"http://localhost:8080/sse\"}","handlingStrategy":"validation","validationCode":"Result<String> check = mcpManager.processInstallConfig(detail.getDeployConfig(), detail.getInstallType());\nif (!check.isSuccess()) { throw new IllegalArgumentException(\"Invalid deployConfig: \" + check.getMessage()); }","typeGuard":null,"tryCatchPattern":"try {\n    mcpService.updateMcp(detail);\n} catch (BizException e) {\n    if (\"UpdateMCPServerError\".equals(e.getCode())) {\n        log.error(\"MCP update failed\", e.getCause()); // check whether parse or infra\n    } else { throw e; }\n}","preventionTips":["Pre-validate deployConfig for the target installType before updating","When switching install types, rewrite the config fields accordingly","Ensure the config JSON is complete and not truncated"],"tags":["mcp","config","json","update"],"backgroundTag":"json-unmarshal-failed","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"}