siyuan-note/siyuan · error
Uninstall failed: %s
Error message
Uninstall failed: %s
What it means
Wraps any non-nil error returned by bazaar.UninstallPackage(installPath). The install path was resolved successfully (so the package exists), but the physical removal failed. Conf.Language(47) is the localized 'Uninstall failed: %s' template; the underlying cause is interpolated.
Source
Thrown at kernel/model/bazaar.go:697
return "", err
}
for _, info := range installedInfos {
if info.Pkg.Name == packageName {
return filepath.Join(basePath, info.DirName), nil
}
}
return "", errors.New("installed package not found")
}
func UninstallPackage(pkgType, packageName string) error {
installPath, err := getPackageUninstallPath(pkgType, packageName)
if err != nil {
return err
}
err = bazaar.UninstallPackage(installPath)
if err != nil {
return fmt.Errorf(Conf.Language(47), err.Error())
}
// 删除集市包的持久化信息
bazaar.RemovePackageInfo(pkgType, packageName)
bazaar.RemoveInstalledPackageSizeCache(pkgType, packageName)
switch pkgType {
case "plugins":
petals := getPetals()
var tmp []*Petal
for i, petal := range petals {
if petal.Name != packageName {
tmp = append(tmp, petals[i])
}
}
petals = tmp
savePetals(petals)
View on GitHub (pinned to 251596fc0d)
Solutions
- Close SiYuan / stop the kernel so file handles release, then retry the uninstall.
- Inspect the wrapped error string for the OS-level cause (permission, sharing violation, ENOSPC).
- Manually remove the directory under data/<pkgType>/<DirName> and clear the cached package info.
- Restart the kernel and retry once, to rule out a transient lock.
Defensive patterns
Strategy: retry
Validate before calling
info, err := os.Stat(installPath)
if err != nil {
// already gone; nothing to uninstall
return nil
} Try / catch
err = model.UninstallPackage(pkgType, name)
if err != nil && strings.Contains(err.Error(), Conf.Language(47)) {
// likely a transient file lock; release handles and retry once
time.Sleep(200 * time.Millisecond)
err = model.UninstallPackage(pkgType, name)
} Prevention
- Make sure no plugin code is actively reading from the install dir before uninstalling.
- On Windows, ensure the Electron app is not holding file handles.
- Surface the wrapped error string to the user so they can address the OS-level cause.
When it happens
Trigger: Files in the install directory are open or locked (common on Windows when the kernel holds a handle); the data folder is on a read-only or full filesystem; the plugin is currently loaded and its files are mapped; the install directory was partially deleted out of band.
Common situations: Windows file locking during plugin uninstall; mobile storage permission denial; NFS/network share glitches; corrupted or half-removed package directory left behind by a prior failed uninstall.
Related errors
- remove community package [%s] failed
- marketplace package install path already exists
- install local marketplace package failed: %w; rollback faile
- load block tree [%s] failed: %w
- failed to make directory: %w
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/1b5452690977f3bb.
Report an issue: GitHub.