alibaba/spring-ai-alibaba · error · BizException

UpdateMCPServerError

UpdateMCPServerError

Error message

Failed to update MCPServer. fail parse InstallConfig

What it means

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.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/McpServerServiceImpl.java:161

			if (!checkResult.isSuccess()) {
				throw new Exception(String.valueOf(checkResult.getMessage()));
			}
			entity.setDeployConfig(checkResult.getData());
			entity.setHost(fetchHost(checkResult.getData()));
			entity.setDetailConfig(detail.getDetailConfig());
			entity.setDescription(detail.getDescription());
			entity.setStatus(detail.getStatus());
			entity.setBizType(detail.getBizType());
			entity.setInstallType(detail.getInstallType());
			entity.setDeployEnv(detail.getDeployEnv());
			entity.setSource(detail.getSource());
			entity.setType(detail.getType() == null ? McpServerTypeEnum.CUSTOMER.name() : detail.getType());
			this.updateById(entity);
			String key = getMcpCacheKey(context.getWorkspaceId(), serverCode);
			redisManager.put(key, entity);
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.UPDATE_MCP_ERROR.toError("fail parse InstallConfig"), e);
		}

	}

	/**
	 * Marks an MCP server as deleted
	 * @param serverCode Unique identifier of the server
	 */
	@Override
	public void deleteMcp(String serverCode) {
		try {
			RequestContext context = RequestContextHolder.getRequestContext();
			McpServerEntity entity = getMcpByCode(context.getWorkspaceId(), serverCode, null);
			if (entity == null) {
				throw new BizException(MCP_NOT_FOUND.toError());
			}
			entity.setGmtModified(new Date());
			entity.setStatus(McpServerStatusEnum.Deleted.getCode());

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Read the cause exception in logs to identify whether it is a config parse failure or an infrastructure error.
  2. Ensure deployConfig matches the schema required by the specified installType before updating.
  3. Retry if the failure was transient (e.g. Redis unavailability during cache write).

Example fix

// before (sse type given stdio config)
{"command": "npx", "args": ["-y", "server"]}
// after (matching installType "sse")
{"url": "http://localhost:8080/sse"}
Defensive patterns

Strategy: validation

Validate before calling

Result<String> check = mcpManager.processInstallConfig(detail.getDeployConfig(), detail.getInstallType());
if (!check.isSuccess()) { throw new IllegalArgumentException("Invalid deployConfig: " + check.getMessage()); }

Try / catch

try {
    mcpService.updateMcp(detail);
} catch (BizException e) {
    if ("UpdateMCPServerError".equals(e.getCode())) {
        log.error("MCP update failed", e.getCause()); // check whether parse or infra
    } else { throw e; }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/2840991817b69bec. Report an issue: GitHub.