{"record":{"id":"7eee18e292d86100","repo":"siyuan-note/siyuan","slug":"failed-to-install-marketplace-package-s-s","errorCode":null,"errorMessage":"Failed to install marketplace package [%s]: %s","messagePattern":"Failed to install marketplace package \\[(.+?)\\]: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/bazaar.go","lineNumber":519,"sourceCode":"\nfunc GetBazaarPackageREADME(ctx context.Context, repoURL, repoHash, pkgType string) (ret string) {\n\tret = bazaar.GetBazaarPackageREADME(ctx, repoURL, repoHash, pkgType)\n\treturn\n}\n\n// installBazaarPackage 下载并安装集市包\nfunc installBazaarPackage(pkgType, repoURL, repoHash, packageName string) (meta installMeta, err error) {\n\tinstallPath, jsonFileName, err := getPackageInstallPath(pkgType, packageName)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinstalledPkg, parseErr := bazaar.ParsePackageJSON(filepath.Join(installPath, jsonFileName))\n\tmeta.update = parseErr == nil && installedPkg != nil && installedPkg.Name == packageName\n\n\terr = bazaar.InstallPackage(repoURL, repoHash, installPath, Conf.System.ID, pkgType, packageName, meta.update)\n\tif err != nil {\n\t\terr = fmt.Errorf(Conf.Language(46), packageName, err)\n\t}\n\treturn\n}\n\n// finishInstall 集市包安装后的处理（刷新外观、推送插件重载等）；批量更新时同类型只执行一次\n//\n//   - themeOptions：仅在新安装主题（meta.update 为 false）时写入外观；批量覆盖更新不会用到\n//   - applyNewAppearance：控制新安装图标是否自动应用；本地安装不自动应用\nfunc finishInstall(pkgType string, items []batchInstallItem, themeOptions *ThemeInstallOptions, applyNewAppearance bool) {\n\tif 1 > len(items) {\n\t\treturn\n\t}\n\n\tswitch pkgType {\n\tcase \"plugins\":\n\t\treloadPluginSet := hashset.New()\n\t\tfor _, item := range items {\n\t\t\tif !item.meta.update {","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/model/bazaar.go#L501-L537","documentation":"Wrapped error produced in model.installBazaarPackage (kernel/model/bazaar.go:519): when bazaar.InstallPackage fails, the cause is wrapped with the localized template Conf.Language(46), i.e. \"Failed to install marketplace package [<name>]: <cause>\". The underlying cause comes from the whole download-and-install pipeline in kernel/bazaar/install.go: network download of repo@hash (downloadBazaarFile), unzip, the anti-takeover guards (non-empty target dir, missing/invalid manifest, name mismatch), and the final file copy to the install path.","triggerScenarios":"Calling model.InstallBazaarPackage / /api/bazaar/installBazaarPackage when: the GitHub-hosted package zip cannot be downloaded (offline, proxy, 404 for a deleted release); the target directory data/<type>/<name> already has content and the local manifest is absent/mismatched so update=false (\"marketplace package install path already exists\"); the archive's manifest name differs from packageName; the zip is corrupt.","commonSituations":"Corporate proxies blocking the bazaar download domain; installing a package whose previous install left files behind after a crashed update; marketplace metadata pointing at a repo hash that no longer exists; disk full or permission errors under the workspace data directory.","solutions":["Read the text after the colon: it is the true cause (network error, 'marketplace package install path already exists', 'manifest not found or invalid', 'name mismatch', unzip/copy failure)","For the install-path-exists cause, uninstall the leftover package or update it instead of installing fresh","For network causes, check connectivity to the bazaar/cloud server and retry the install","For name mismatch or invalid manifest, verify the package on the marketplace and install a fixed version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := model.InstallBazaarPackage(pkgType, repoURL, repoHash, name, nil)\nif err != nil {\n    msg := err.Error()\n    switch {\n    case strings.Contains(msg, \"install path already exists\"):\n        // uninstall or update instead\n    case strings.Contains(msg, \"manifest not found\"), strings.Contains(msg, \"name mismatch\"):\n        // package broken on marketplace; report\n    default:\n        // network/disk cause: surface message, allow manual retry\n    }\n}","preventionTips":["Log the full wrapped message; the cause after ': ' selects the remedy","Before installing, check the target is not a half-installed directory (uninstall leftovers)","Keep retry buttons manual — network causes may be transient but retry storms waste quota"],"tags":["marketplace","bazaar","package-install","wrapped-error","download","i18n"],"backgroundTag":"package-install-failed","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}