alibaba/spring-ai-alibaba · error · BizException

CreatePluginError

CreatePluginError

Error message

Failed to create plugin.

What it means

Generic wrapper thrown by PluginServiceImpl.createPlugin when any unexpected exception occurs during plugin creation (after the specific BizException checks have been rethrown unchanged). Typically a persistence, cache, or serialization failure.

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

			entity.setStatus(PluginStatus.NORMAL);

			entity.setGmtCreate(new Date());
			entity.setGmtModified(new Date());
			entity.setCreator(context.getAccountId());
			entity.setModifier(context.getAccountId());

			this.save(entity);

			String key = getPluginCacheKey(entity.getWorkspaceId(), entity.getPluginId());
			redisManager.put(key, entity);

			return pluginId;
		}
		catch (BizException e) {
			throw e;
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.CREATE_PLUGIN_ERROR.toError(), e);
		}
	}

	/**
	 * Updates an existing plugin
	 * @param plugin Updated plugin information
	 */
	@Override
	public void updatePlugin(Plugin plugin) {
		try {
			RequestContext context = RequestContextHolder.getRequestContext();

			PluginEntity entity = getPluginById(context.getWorkspaceId(), plugin.getPluginId());
			if (entity == null) {
				throw new BizException(ErrorCode.PLUGIN_NOT_FOUND.toError());
			}

			// check if plugin name exists

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Read the wrapped cause in the log for the underlying failure
  2. Verify database and Redis connectivity
  3. Check plugin payload fields (name, config) for nulls/oversized values
  4. Catch BizException(CreatePluginError) at the controller and return a 500-style response

Example fix

// before
String id = pluginService.createPlugin(plugin); // may throw opaque CreatePluginError
// after
try {
    String id = pluginService.createPlugin(plugin);
} catch (BizException e) {
    log.error("Plugin create failed", e.getCause());
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (plugin.getName() == null || plugin.getName().isBlank())
    throw new IllegalArgumentException("plugin.name required");
JsonUtils.toJson(plugin.getConfig()); // fail fast on non-serializable config

Try / catch

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

Prevention

When it happens

Trigger: createPlugin(plugin) throws a non-BizException during ID generation, BeanCopierUtils.copy, DB insert, or redis cache write.

Common situations: Database connection failure mid-insert; Redis unavailability when caching the new plugin; mapping errors from malformed plugin config JSON; DB schema drift after version upgrade.

Related errors


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