{"record":{"id":"1b5452690977f3bb","repo":"siyuan-note/siyuan","slug":"uninstall-failed-s","errorCode":null,"errorMessage":"Uninstall failed: %s","messagePattern":"Uninstall failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/bazaar.go","lineNumber":697,"sourceCode":"\t\treturn \"\", err\n\t}\n\tfor _, info := range installedInfos {\n\t\tif info.Pkg.Name == packageName {\n\t\t\treturn filepath.Join(basePath, info.DirName), nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"installed package not found\")\n}\n\nfunc UninstallPackage(pkgType, packageName string) error {\n\tinstallPath, err := getPackageUninstallPath(pkgType, packageName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = bazaar.UninstallPackage(installPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(Conf.Language(47), err.Error())\n\t}\n\n\t// 删除集市包的持久化信息\n\tbazaar.RemovePackageInfo(pkgType, packageName)\n\tbazaar.RemoveInstalledPackageSizeCache(pkgType, packageName)\n\n\tswitch pkgType {\n\tcase \"plugins\":\n\t\tpetals := getPetals()\n\t\tvar tmp []*Petal\n\t\tfor i, petal := range petals {\n\t\t\tif petal.Name != packageName {\n\t\t\t\ttmp = append(tmp, petals[i])\n\t\t\t}\n\t\t}\n\t\tpetals = tmp\n\t\tsavePetals(petals)\n","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/bazaar.go#L679-L715","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"info, err := os.Stat(installPath)\nif err != nil {\n    // already gone; nothing to uninstall\n    return nil\n}","typeGuard":null,"tryCatchPattern":"err = model.UninstallPackage(pkgType, name)\nif err != nil && strings.Contains(err.Error(), Conf.Language(47)) {\n    // likely a transient file lock; release handles and retry once\n    time.Sleep(200 * time.Millisecond)\n    err = model.UninstallPackage(pkgType, name)\n}","preventionTips":["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."],"tags":["bazaar","uninstall","filesystem","io-error"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}