alibaba/spring-ai-alibaba · error · BizException
PluginNotFound
PluginNotFound
Error message
Plugin can not be found.
What it means
updatePlugin in PluginServiceImpl throws BizException(PLUGIN_NOT_FOUND) when getPluginById finds no plugin for the given workspaceId and pluginId — the plugin was deleted or the id/workspace combination is wrong.
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:137
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
PluginEntity pluginEntity = getPluginByName(context.getWorkspaceId(), plugin.getName());
if (pluginEntity != null && !pluginEntity.getId().equals(entity.getId())) {
throw new BizException(ErrorCode.PLUGIN_NAME_EXISTS.toError());
}
entity.setName(plugin.getName());
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());
View on GitHub (pinned to f82da0b50f)
Solutions
- Confirm the pluginId exists via getPlugin(pluginId) before updating
- Refresh the plugin list and use the current pluginId
- Check the RequestContext workspaceId matches the plugin's workspace
Example fix
// before
plugin.setPluginId(oldIdFromCache);
pluginService.updatePlugin(plugin);
// after
try {
pluginService.getPlugin(plugin.getPluginId());
pluginService.updatePlugin(plugin);
} catch (BizException e) {
// refresh from server: plugin was deleted or id stale
plugin = pluginService.listPlugins().stream()
.filter(p -> p.getName().equals(plugin.getName())).findFirst().orElseThrow();
pluginService.updatePlugin(plugin);
} Defensive patterns
Strategy: validation
Validate before calling
try {
pluginService.getPlugin(plugin.getPluginId()); // throws PluginNotFound if stale
} catch (BizException e) {
plugin = refreshPluginFromServer(plugin.getName());
} Type guard
boolean pluginExists(String pluginId) {
try { pluginService.getPlugin(pluginId); return true; }
catch (BizException e) { return false; }
} Try / catch
try {
pluginService.updatePlugin(plugin);
} catch (BizException e) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, plugin.getPluginId(), e);
} Prevention
- Re-fetch plugin lists before updates after deletions
- Never cache pluginId across workspaces
- Confirm the request carries pluginId (not tool id or name)
- Handle deleted-plugin cases in UI flows
When it happens
Trigger: Calling updatePlugin(plugin) with plugin.getPluginId() that is null, was deleted, or belongs to another workspace.
Common situations: Client caching a stale pluginId after deletion; copying update code across workspaces; passing name instead of pluginId in the request body.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/b2fc20856b4338e3.
Report an issue: GitHub.