alibaba/spring-ai-alibaba · error · BizException

UpdatePluginError

UpdatePluginError

Error message

Failed to create plugin.

What it means

Generic wrapper thrown by PluginServiceImpl.updatePlugin when a non-BizException occurs while persisting or caching the plugin update (name conflicts and not-found cases are thrown as their own codes first).

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:165

			entity.setDescription(plugin.getDescription());

			String config = JsonUtils.toJson(plugin.getConfig());
			entity.setConfig(config);

			entity.setSource(plugin.getSource());
			entity.setGmtModified(new Date());
			entity.setModifier(context.getWorkspaceId());

			this.updateById(entity);

			String key = getPluginCacheKey(entity.getWorkspaceId(), entity.getPluginId());
			redisManager.put(key, entity);
		}
		catch (BizException e) {
			throw e;
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.UPDATE_PLUGIN_ERROR.toError(), e);
		}
	}

	/**
	 * Deletes a plugin and its associated tools
	 * @param pluginId ID of the plugin to delete
	 */
	@Override
	public void deletePlugin(String pluginId) {
		RequestContext context = RequestContextHolder.getRequestContext();
		PluginEntity entity = getPluginById(context.getWorkspaceId(), pluginId);
		if (entity == null) {
			return;
		}

		// delete all tools first
		LambdaQueryWrapper<ToolEntity> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(ToolEntity::getPluginId, pluginId)

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Inspect the wrapped cause for the real error
  2. Verify Redis and database health
  3. Validate plugin config JSON-serializability before calling update
  4. Catch BizException(UpdatePluginError) and return a server-error response

Example fix

// before
pluginService.updatePlugin(plugin);
// after
try {
    JsonUtils.toJson(plugin.getConfig()); // fail fast on bad config
    pluginService.updatePlugin(plugin);
} catch (BizException e) {
    log.error("update failed: {}", e.getCause());
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure config is JSON-serializable and entity exists before update
JsonUtils.toJson(plugin.getConfig());
pluginService.getPlugin(plugin.getPluginId());

Try / catch

try {
    pluginService.updatePlugin(plugin);
} catch (BizException e) {
    log.error("Update failed, cause: {}", e.getCause());
    throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());
}

Prevention

When it happens

Trigger: updatePlugin fails during entity mutation, JsonUtils.toJson of config, DB update, or redisManager.put of the cache entry.

Common situations: Redis outage on cache refresh; oversized/invalid plugin config breaking JSON serialization; DB constraint violations or connection loss during update.

Related errors


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