{"record":{"id":"87705d1ab1dd661b","repo":"siyuan-note/siyuan","slug":"conf-language-47","errorCode":null,"errorMessage":"Conf.Language(47)","messagePattern":"Conf\\.Language\\(47\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/bazaar.go","lineNumber":714,"sourceCode":"\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\tif pkgType == \"plugins\" {\n\t\tpluginPublishLock.Lock()\n\t\tdefer pluginPublishLock.Unlock()\n\t\tif err = removePluginPublishData(packageName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\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":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bazaar.go#L696-L732","documentation":"UninstallPackage calls bazaar.UninstallPackage to delete the package directory; when that OS-level removal fails (permission denied, files locked, read-only volume), the error is wrapped with localized message Conf.Language(47) containing the underlying error string.","triggerScenarios":"Uninstalling while the theme/icon is applied or the plugin is loaded and its files are open; workspace on a read-only or network mount; Windows AV/indexer holding a handle on files in the package directory; insufficient user permissions on the workspace path.","commonSituations":"Windows 'file in use' on an active theme's assets; Linux workspace owned by another user after running SiYuan with sudo once; disk errors; Docker volumes mounted read-only.","solutions":["Read the underlying cause embedded in the localized message (e.g. 'file in use', 'access denied')","Disable/switch away from the plugin/theme/icon, then retry the uninstall","Fix permissions on the workspace package directory (chown/chmod or take ownership on Windows)","Retry after closing other processes (AV scans, editors, sync clients) that hold handles"],"exampleFix":"// before\nif err := model.UninstallPackage(\"themes\", name); err != nil { return err }\n// after: disable theme before uninstall\nmodel.Conf.Appearance.ThemeDark = \"\" // switch away from the theme first, save conf\nif err := model.UninstallPackage(\"themes\", name); err != nil {\n    logging.LogErrorf(\"uninstall %s failed: %v\", name, err)\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// check writability of the install dir first\nprobe := filepath.Join(installPath, \".write-test\")\nif err := os.WriteFile(probe, nil, 0o644); err != nil { return fmt.Errorf(\"not writable: %w\", err) }\nos.Remove(probe)","typeGuard":null,"tryCatchPattern":"err := model.UninstallPackage(pkgType, name)\nif err != nil {\n  // err embeds Conf.Language(47) with the OS cause\n  logging.LogErrorf(\"uninstall %s: %v\", name, err)\n  return promptUserToDisableAndRetry(err)\n}","preventionTips":["Disable the plugin / switch away from the theme before uninstalling","Keep workspace paths owned by the user running SiYuan","Exclude workspace dirs from indexers and AV file locks"],"tags":["marketplace","uninstall","file-lock","i18n"],"backgroundTag":"file-write-failed","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}