{"record":{"id":"b2fc20856b4338e3","repo":"alibaba/spring-ai-alibaba","slug":"pluginnotfound","errorCode":"PluginNotFound","errorMessage":"Plugin can not be found.","messagePattern":"Plugin can not be found\\.","errorType":"error_code","errorClass":"BizException","httpStatus":404,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/PluginServiceImpl.java","lineNumber":137,"sourceCode":"\t\t\tthrow e;\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new BizException(ErrorCode.CREATE_PLUGIN_ERROR.toError(), e);\n\t\t}\n\t}\n\n\t/**\n\t * Updates an existing plugin\n\t * @param plugin Updated plugin information\n\t */\n\t@Override\n\tpublic void updatePlugin(Plugin plugin) {\n\t\ttry {\n\t\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\n\t\t\tPluginEntity entity = getPluginById(context.getWorkspaceId(), plugin.getPluginId());\n\t\t\tif (entity == null) {\n\t\t\t\tthrow new BizException(ErrorCode.PLUGIN_NOT_FOUND.toError());\n\t\t\t}\n\n\t\t\t// check if plugin name exists\n\t\t\tPluginEntity pluginEntity = getPluginByName(context.getWorkspaceId(), plugin.getName());\n\t\t\tif (pluginEntity != null && !pluginEntity.getId().equals(entity.getId())) {\n\t\t\t\tthrow new BizException(ErrorCode.PLUGIN_NAME_EXISTS.toError());\n\t\t\t}\n\n\t\t\tentity.setName(plugin.getName());\n\t\t\tentity.setDescription(plugin.getDescription());\n\n\t\t\tString config = JsonUtils.toJson(plugin.getConfig());\n\t\t\tentity.setConfig(config);\n\n\t\t\tentity.setSource(plugin.getSource());\n\t\t\tentity.setGmtModified(new Date());\n\t\t\tentity.setModifier(context.getWorkspaceId());\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/PluginServiceImpl.java#L119-L155","documentation":"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.","triggerScenarios":"Calling updatePlugin(plugin) with plugin.getPluginId() that is null, was deleted, or belongs to another workspace.","commonSituations":"Client caching a stale pluginId after deletion; copying update code across workspaces; passing name instead of pluginId in the request body.","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"],"exampleFix":"// before\nplugin.setPluginId(oldIdFromCache);\npluginService.updatePlugin(plugin);\n// after\ntry {\n    pluginService.getPlugin(plugin.getPluginId());\n    pluginService.updatePlugin(plugin);\n} catch (BizException e) {\n    // refresh from server: plugin was deleted or id stale\n    plugin = pluginService.listPlugins().stream()\n        .filter(p -> p.getName().equals(plugin.getName())).findFirst().orElseThrow();\n    pluginService.updatePlugin(plugin);\n}","handlingStrategy":"validation","validationCode":"try {\n    pluginService.getPlugin(plugin.getPluginId()); // throws PluginNotFound if stale\n} catch (BizException e) {\n    plugin = refreshPluginFromServer(plugin.getName());\n}","typeGuard":"boolean pluginExists(String pluginId) {\n    try { pluginService.getPlugin(pluginId); return true; }\n    catch (BizException e) { return false; }\n}","tryCatchPattern":"try {\n    pluginService.updatePlugin(plugin);\n} catch (BizException e) {\n    throw new ResponseStatusException(HttpStatus.NOT_FOUND, plugin.getPluginId(), e);\n}","preventionTips":["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"],"tags":["plugin","not-found","stale-id"],"backgroundTag":"resource-not-found","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}