flipped-aurora/gin-vue-admin · error

已存在同名插件,请自行手动安装

Error message

已存在同名插件,请自行手动安装

What it means

installation() refuses to copy a plugin when the destination (AutoCode.Root + toPath + 'plugin' + name) already exists on disk (os.Stat succeeds). This prevents overwriting an already-installed server or web plugin; the message includes toPath to say which side (server/web) collided.

Source

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

	}

	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
	}
	if err = os.MkdirAll(serverRoot, 0755); err != nil {
		return -1, -1, err
	}
	tempDir, err := os.MkdirTemp(serverRoot, "gva-plugin-")
	if err != nil {
		return -1, -1, err
	}
	defer os.RemoveAll(tempDir)

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Delete or rename the existing plugin directory at the reported destination, then re-run the install.
  2. If updating an existing plugin, use the plugin upgrade/manual-replace flow instead of first-time install.
  3. Check the plugin's package name in enter.go and rename your new plugin to a unique directory name.

Example fix

// before
server/plugin/email/  (already exists) -> install 'email' again fails
// after
rm -rf server/plugin/email web/src/plugin/email  # or rename new plugin
# then re-run install
Defensive patterns

Strategy: validation

Validate before calling

const target = `server/plugin/${pluginName}`
if (fs.existsSync(target) || fs.existsSync(`web/src/plugin/${pluginName}`)) {
  throw new Error('已存在同名插件,请自行手动安装')
}

Try / catch

_, _, err := pluginService.Install(file)
if err != nil && strings.Contains(err.Error(), "已存在同名插件") {
    // prompt user to remove/rename existing plugin, or treat as update via manual copy
    return err
}

Prevention

When it happens

Trigger: Installing the same plugin zip twice; installing a different plugin whose directory name equals an existing one in server/plugin/ or web/src/plugin/.

Common situations: Re-running an install script after a partial failure; two vendors shipping plugins with the same directory name; forgetting the plugin was installed on this environment.

Related errors


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