{"record":{"id":"13d4fc2b5b80abbd","repo":"alibaba/spring-ai-alibaba","slug":"createpluginerror","errorCode":"CreatePluginError","errorMessage":"Failed to create plugin.","messagePattern":"Failed to create plugin\\.","errorType":"error_code","errorClass":"BizException","httpStatus":500,"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":122,"sourceCode":"\t\t\tentity.setStatus(PluginStatus.NORMAL);\n\n\t\t\tentity.setGmtCreate(new Date());\n\t\t\tentity.setGmtModified(new Date());\n\t\t\tentity.setCreator(context.getAccountId());\n\t\t\tentity.setModifier(context.getAccountId());\n\n\t\t\tthis.save(entity);\n\n\t\t\tString key = getPluginCacheKey(entity.getWorkspaceId(), entity.getPluginId());\n\t\t\tredisManager.put(key, entity);\n\n\t\t\treturn pluginId;\n\t\t}\n\t\tcatch (BizException e) {\n\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","sourceCodeStart":104,"sourceCodeEnd":140,"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#L104-L140","documentation":"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.","triggerScenarios":"createPlugin(plugin) throws a non-BizException during ID generation, BeanCopierUtils.copy, DB insert, or redis cache write.","commonSituations":"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.","solutions":["Read the wrapped cause in the log for the underlying failure","Verify database and Redis connectivity","Check plugin payload fields (name, config) for nulls/oversized values","Catch BizException(CreatePluginError) at the controller and return a 500-style response"],"exampleFix":"// before\nString id = pluginService.createPlugin(plugin); // may throw opaque CreatePluginError\n// after\ntry {\n    String id = pluginService.createPlugin(plugin);\n} catch (BizException e) {\n    log.error(\"Plugin create failed\", e.getCause());\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (plugin.getName() == null || plugin.getName().isBlank())\n    throw new IllegalArgumentException(\"plugin.name required\");\nJsonUtils.toJson(plugin.getConfig()); // fail fast on non-serializable config","typeGuard":null,"tryCatchPattern":"try {\n    pluginService.createPlugin(plugin);\n} catch (BizException e) {\n    log.error(\"Create failed, cause: {}\", e.getCause());\n    throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());\n}","preventionTips":["Validate the plugin payload before calling create","Keep DB and Redis connections pooled and monitored","Test plugin config serialization locally","Upgrade paths: verify schema migrations ran"],"tags":["plugin","persistence","internal"],"backgroundTag":"database-write-failed","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"}