alibaba/spring-ai-alibaba · error · BizException

UpdateToolError

UpdateToolError

Error message

Failed to create tool.

What it means

Generic wrapper thrown by updateTool (message text reused from the create path) when any non-BizException escapes the update flow. The original failure is attached as cause — typically the database update (toolMapper.updateById) or the Redis cache put (redisManager.put) failed.

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/PluginServiceImpl.java:395

			entity.setApiSchema(yaml);
			entity.setGmtModified(new Date());
			entity.setModifier(context.getAccountId());

			if (entity.getStatus() == ToolStatus.PUBLISHED) {
				entity.setStatus(ToolStatus.PUBLISHED_EDITING);
			}

			toolMapper.updateById(entity);

			// cache it
			String key = getToolCacheKey(entity.getWorkspaceId(), entity.getToolId());
			redisManager.put(key, entity);
		}
		catch (BizException e) {
			throw e;
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.UPDATE_TOOL_ERROR.toError(), e);
		}
	}

	/**
	 * Deletes a tool
	 * @param toolId ID of the tool to delete
	 */
	@Override
	public void deleteTool(String toolId) {
		RequestContext context = RequestContextHolder.getRequestContext();
		// delete from db
		ToolEntity entity = getToolById(context.getWorkspaceId(), toolId);
		if (entity == null) {
			return;
		}

		entity.setStatus(ToolStatus.DELETED);
		entity.setGmtModified(new Date());

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Read the chained cause of this BizException in server logs to find the real exception.
  2. Verify database connectivity and that the tool row still exists and is updatable.
  3. Check Redis availability for the tool cache write.
  4. Retry the update once the infrastructure issue is resolved.
  5. If config JSON exceeds column limits, shorten the apiSchema/config payloads.

Example fix

// before: no cause inspection
catch (BizException e) { log.error("update failed"); }

// after: surface the cause
catch (BizException e) {
    log.error("update failed", e.getCause());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm the tool still exists before attempting the update
Tool current = toolService.getTool(toolId);
if (current == null) { throw new IllegalStateException("tool missing, abort update"); }

Try / catch

try {
    toolService.updateTool(context, tool);
} catch (BizException e) {
    // wrapped infrastructure failure: inspect and rethrow with cause
    Throwable cause = e.getCause();
    log.error("updateTool infra failure", cause);
    throw new RuntimeException(cause);
}

Prevention

When it happens

Trigger: Any non-BizException inside updateTool after validation passes: DB update failure (row locked, connection lost, schema mismatch), JsonUtils.toJson failure on the new config, redisManager.put failure writing the refreshed cache entry.

Common situations: Database connection pool exhausted under load; optimistic-lock/column-length issues on apiSchema or config columns; Redis node down making cache writes fail.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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