flipped-aurora/gin-vue-admin · error

arr

Error message

arr

What it means

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.

Source

Thrown at server/service/system/auto_code_plugin.go:147

			return webIndex, serverIndex, err
		}
	}

	if len(webPlugin) != 0 {
		err = installation(webPlugin, global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.Web)
		if err != nil {
			return webIndex, serverIndex, err
		}
	}

	return 1, 1, err
}

func installation(path string, formPath string, toPath string) error {
	arr := strings.Split(filepath.ToSlash(path), "/")
	ln := len(arr)
	if ln < 3 {
		return errors.New("arr")
	}
	name := arr[ln-3]

	var form = filepath.Join(global.GVA_CONFIG.AutoCode.Root, formPath, path)
	var to = filepath.Join(global.GVA_CONFIG.AutoCode.Root, toPath, "plugin")
	_, err := os.Stat(to + name)
	if err == nil {
		zap.L().Error("autoPath 已存在同名插件,请自行手动安装", zap.String("to", to))
		return errors.New(toPath + "已存在同名插件,请自行手动安装")
	}
	return cp.Copy(form, to, cp.Options{Skip: skipMacSpecialDocument})
}

func (s *autoCodePlugin) installSubPlugin(file *multipart.FileHeader, parentPlugin string) (web, server int, err error) {
	serverRoot, err := utils.JoinWithinRoot(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server)
	if err != nil {
		return -1, -1, err
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Ensure the archive contains full nested paths: <root>/server/plugin/<pluginName>/... (at least 3 segments after the root split).
  2. Re-zip including the plugin name directory rather than loose files.
  3. If you maintain the code, consider replacing the 'arr' sentinel with a descriptive error mentioning the offending path.

Example fix

// before (entry too shallow)
server/plugin
// after (entry includes plugin dir)
server/plugin/myplugin/main.go
Defensive patterns

Strategy: validation

Validate before calling

// Before calling install flows, ensure candidate paths have >= 3 segments:
parts := strings.Split(filepath.ToSlash(path), "/")
if len(parts) < 3 {
    return fmt.Errorf("插件路径层级不足: %q", path)
}

Try / catch

if err := installation(path, formPath, toPath); err != nil {
    if err.Error() == "arr" {
        return fmt.Errorf("路径 %q 缺少插件目录名,请检查压缩包结构", path)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/31572006675aa524. Report an issue: GitHub.