siyuan-note/siyuan · error
localized uninstall failure message (Conf.Language(47)) with
Error message
localized uninstall failure message (Conf.Language(47)) with error detail
What it means
UninstallPackage resolves the install path and then calls bazaar.UninstallPackage to delete the package directory. If the deletion fails, the kernel wraps the error with the localized message Conf.Language(47) and the error detail. The package remains on disk because the actual removal operation failed.
Source
Thrown at kernel/model/bazaar.go:707
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 8641553a1f)
Solutions
- Read the wrapped detail in the message to identify the OS-level cause.
- Ensure the package is not in use (disable the plugin/switch themes) and retry the uninstall.
- Check write/delete permissions on the workspace's package directory and remove locks (antivirus, other processes).
- As a last resort, manually delete the package directory, then remove its persisted info via bazaar.RemovePackageInfo.
Example fix
// before: uninstalling while plugin is active
model.UninstallPackage("plugins", "my-plugin")
// after: disable the plugin first, then uninstall
model.UninstallPackage("plugins", "my-plugin") // ensure disablePlugin ran first
// e.g. api: POST /api/bazaar/uninstallBazaarPlugin after disabling via setting Defensive patterns
Strategy: try-catch
Try / catch
if err := model.UninstallPackage(pkgType, name); err != nil {
log.Errorf("uninstall failed (package may be in use): %v", err)
return fmt.Errorf("uninstall %s failed: %w", name, err)
} Prevention
- Disable/deactivate the package before uninstalling
- Check file locks and permissions on the package directory
- Retry once after a short delay if deletion fails on Windows
When it happens
Trigger: Calling UninstallPackage where bazaar.UninstallPackage fails — typically because files in the install directory are locked (editor/plugin still loaded), the process lacks write/delete permission on the package directory, or the directory was concurrently removed.
Common situations: Uninstalling a theme/plugin that is currently in use on Windows (file in use); kernel process running without permission over another user's package directory; antivirus holding files open; network-mapped workspace drives with delayed deletes.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- get bazaar package failed: %s
- install local marketplace package failed: %w; rollback faile
- Uninstall failed: %s
- read session file failed: %w
- create session dir failed: %w
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/5f27b0dc427b98b6.
Report an issue: GitHub.