{"record":{"id":"31572006675aa524","repo":"flipped-aurora/gin-vue-admin","slug":"arr","errorCode":null,"errorMessage":"arr","messagePattern":"arr","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_plugin.go","lineNumber":147,"sourceCode":"\t\t\treturn webIndex, serverIndex, err\n\t\t}\n\t}\n\n\tif len(webPlugin) != 0 {\n\t\terr = installation(webPlugin, global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.Web)\n\t\tif err != nil {\n\t\t\treturn webIndex, serverIndex, err\n\t\t}\n\t}\n\n\treturn 1, 1, err\n}\n\nfunc installation(path string, formPath string, toPath string) error {\n\tarr := strings.Split(filepath.ToSlash(path), \"/\")\n\tln := len(arr)\n\tif ln < 3 {\n\t\treturn errors.New(\"arr\")\n\t}\n\tname := arr[ln-3]\n\n\tvar form = filepath.Join(global.GVA_CONFIG.AutoCode.Root, formPath, path)\n\tvar to = filepath.Join(global.GVA_CONFIG.AutoCode.Root, toPath, \"plugin\")\n\t_, err := os.Stat(to + name)\n\tif err == nil {\n\t\tzap.L().Error(\"autoPath 已存在同名插件，请自行手动安装\", zap.String(\"to\", to))\n\t\treturn errors.New(toPath + \"已存在同名插件，请自行手动安装\")\n\t}\n\treturn cp.Copy(form, to, cp.Options{Skip: skipMacSpecialDocument})\n}\n\nfunc (s *autoCodePlugin) installSubPlugin(file *multipart.FileHeader, parentPlugin string) (web, server int, err error) {\n\tserverRoot, err := utils.JoinWithinRoot(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server)\n\tif err != nil {\n\t\treturn -1, -1, err\n\t}","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_plugin.go#L129-L165","documentation":"installation() splits the plugin's relative path by '/' and derives the plugin name from the third element from the end (arr[ln-3]). With fewer than 3 path segments the name can't be extracted, so it returns this terse placeholder error 'arr'. It is an internal layout guard, not a user-facing message.","triggerScenarios":"installTopLevel finds a candidate path (serverPlugin/webPlugin) but the recorded relative path has fewer than 3 slash-separated segments, e.g. a path like 'server/plugin' without the trailing plugin directory name, produced by a malformed archive entry.","commonSituations":"Archive entries matching the plugin scan regex but with shallow paths (empty directory entries, entries like 'server/plugin' with no child); crafted or corrupted zip structures.","solutions":["Ensure the archive contains full nested paths: <root>/server/plugin/<pluginName>/... (at least 3 segments after the root split).","Re-zip including the plugin name directory rather than loose files.","If you maintain the code, consider replacing the 'arr' sentinel with a descriptive error mentioning the offending path."],"exampleFix":"// before (entry too shallow)\nserver/plugin\n// after (entry includes plugin dir)\nserver/plugin/myplugin/main.go","handlingStrategy":"validation","validationCode":"// Before calling install flows, ensure candidate paths have >= 3 segments:\nparts := strings.Split(filepath.ToSlash(path), \"/\")\nif len(parts) < 3 {\n    return fmt.Errorf(\"插件路径层级不足: %q\", path)\n}","typeGuard":null,"tryCatchPattern":"if err := installation(path, formPath, toPath); err != nil {\n    if err.Error() == \"arr\" {\n        return fmt.Errorf(\"路径 %q 缺少插件目录名，请检查压缩包结构\", path)\n    }\n    return err\n}","preventionTips":["Include the plugin name directory inside the archive; never ship bare 'server/plugin' entries.","Re-zip with standard tooling so directory entries and nested files are recorded correctly.","If maintaining this code, replace the 'arr' sentinel with a message containing the bad path."],"tags":["plugin","path-parsing","autocode"],"backgroundTag":"invalid-path-depth","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}