siyuan-note/siyuan · error
remove community package [%s] failed
Error message
remove community package [%s] failed
What it means
Returned by UninstallPackage (kernel/bazaar/install.go:241-243) when os.RemoveAll(installPath) fails during package uninstall. The underlying OS error is logged via LogErrorf, and the returned error message includes the package directory's base name (filepath.Base(installPath)) for identification.
Source
Thrown at kernel/bazaar/install.go:243
if removeErr := os.RemoveAll(operationPath); removeErr != nil {
logging.LogWarnf("remove local package backup [%s] failed: %s", backupPath, removeErr)
}
}
RemoveInstalledPackageSizeCache(pkgType, packageName)
now := time.Now()
recordPackageOperationTime(pkgType, packageName, now, fallbackInstallTime, update)
if chtimesErr := os.Chtimes(installPath, now, now); chtimesErr != nil {
logging.LogWarnf("set package [%s] folder mtime failed: %s", packageName, chtimesErr)
}
return
}
// UninstallPackage 卸载集市包
func UninstallPackage(installPath string) (err error) {
if err = os.RemoveAll(installPath); err != nil {
logging.LogErrorf("remove [%s] failed: %s", installPath, err)
return fmt.Errorf("remove community package [%s] failed", filepath.Base(installPath))
}
return
}
View on GitHub (pinned to 251596fc0d)
Solutions
- Ensure the package is not actively loaded — disable or close the plugin/theme before uninstalling
- Check filesystem permissions on the install path and its children
- Retry the uninstall after closing applications that may hold file handles
- On Windows, use a tool like Resource Monitor to identify which process locks the files
- Manually remove the directory if the automatic cleanup left residual files
Defensive patterns
Strategy: try-catch
Validate before calling
func checkRemovable(installPath string) error {
info, err := os.Stat(installPath)
if err != nil {
return err
}
if info.IsDir() {
// Try to create and remove a test file inside
test := filepath.Join(installPath, ".remove-test")
if err := os.WriteFile(test, nil, 0644); err != nil {
return fmt.Errorf("directory not removable (locked or read-only): %w", err)
}
os.Remove(test)
}
return nil
} Try / catch
err := bazaar.UninstallPackage(installPath)
if err != nil {
if strings.Contains(err.Error(), "remove community package") {
// Retry once after a short delay — file locks may be transient
time.Sleep(2 * time.Second)
err = bazaar.UninstallPackage(installPath)
}
if err != nil {
// As a last resort, attempt manual recursive removal
os.RemoveAll(installPath)
}
} Prevention
- Disable or unload the package (plugin/theme) before uninstalling to release file handles
- On Windows, close other applications that may lock package files (antivirus, editors)
- Retry uninstall after a brief delay — transient locks from file indexers are common
- Ensure the SiYuan process has write/delete permissions on the package directory
When it happens
Trigger: Calling UninstallPackage when the package directory cannot be fully removed — a file inside it is locked, permissions are insufficient, or the path doesn't exist in a way that causes an error.
Common situations: On Windows, a file in the plugin/theme directory is locked by the Electron process or another application; read-only filesystem; permission denied on a subdirectory; the package's files are in use (e.g. a plugin is actively running); race condition where the directory was already partially removed.
Related errors
- marketplace package install path already exists
- install local marketplace package failed: %w; rollback faile
- bazaar is offline
- get bazaar package failed, please check your network
- get bazaar package failed: %s
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/04e132ab27047b78.
Report an issue: GitHub.