{"record":{"id":"171d94d3b617f5fb","repo":"siyuan-note/siyuan","slug":"marketplace-package-is-incompatible","errorCode":null,"errorMessage":"marketplace package is incompatible","messagePattern":"marketplace package is incompatible","errorType":"exception","errorClass":"ErrLocalBazaarPackageIncompatible","httpStatus":null,"severity":"warning","filePath":"kernel/model/bazaar.go","lineNumber":112,"sourceCode":"}\n\n// ThemeInstallOptions 描述新安装主题后需要应用的外观模式\ntype ThemeInstallOptions struct {\n\tMode   int\n\tModeOS bool\n}\n\n// LocalBazaarPackageInstallResult 描述本地集市包的识别和安装结果。\ntype LocalBazaarPackageInstallResult struct {\n\tPackageType   string `json:\"packageType\"`\n\tPackageName   string `json:\"packageName\"`\n\tMinAppVersion string `json:\"minAppVersion,omitempty\"`\n\tUpdated       bool   `json:\"updated\"`\n}\n\nvar (\n\tErrLocalBazaarPackageExists       = errors.New(\"marketplace package already exists\")\n\tErrLocalBazaarPackageIncompatible = errors.New(\"marketplace package is incompatible\")\n\tlocalBazaarInstallLock            sync.Mutex\n)\n\n// updatePackages 更新一组集市包；同类型批量更新时，安装后处理只执行一次\nfunc updatePackages(packages []*UpdatedPackage, pkgType string, successCount, failedCount *int, planned int) {\n\titems := make([]batchInstallItem, 0, len(packages))\n\tfor _, updated := range packages {\n\t\tpkg := updated.Available\n\t\tmeta, err := installBazaarPackage(pkgType, pkg.RepoURL, pkg.RepoHash, pkg.RepoRef, pkg.Name)\n\t\tif err != nil {\n\t\t\tlogging.LogErrorf(\"update %s [%s] failed: %s\", pkgType, pkg.Name, err)\n\t\t\tutil.PushErrMsg(fmt.Sprintf(Conf.language(238), pkg.Name), 5000)\n\t\t\t*failedCount++\n\t\t\tcontinue\n\t\t}\n\t\titems = append(items, batchInstallItem{name: pkg.Name, meta: meta})\n\t\t*successCount++\n\t\tutil.PushEndlessProgress(fmt.Sprintf(Conf.language(236), *successCount+*failedCount, planned, pkg.Name))","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bazaar.go#L94-L130","documentation":"ErrLocalBazaarPackageIncompatible is a sentinel returned by InstallLocalBazaarPackage when the package's minimum app version or frontend compatibility check fails: bazaar.IsBelowRequiredAppVersion(pkg), or for plugins IsIncompatiblePlugin for the current frontend. The API maps it to reason \"package-incompatible\"; the error message includes the required SiYuan version when the version check failed.","triggerScenarios":"Calling InstallLocalBazaarPackage with a package whose manifest MinAppVersion exceeds the running SiYuan version, or whose plugin is marked incompatible with the current frontend (desktop/mobile).","commonSituations":"Installing a plugin built for a newer SiYuan release; installing a desktop-only plugin on mobile or vice versa; local package manifests with inflated MinAppVersion after partial updates.","solutions":["Upgrade SiYuan to at least the version stated in the error (\"SiYuan %s or later is required\")","Install a version of the package compatible with the current frontend, or skip it on unsupported frontends","Detect with errors.Is(err, model.ErrLocalBazaarPackageIncompatible) and surface a clear 'incompatible' message instead of a generic failure"],"exampleFix":"// before\n_, err := model.InstallLocalBazaarPackage(src, \"plugins\", true, frontend)\n// after\n_, err := model.InstallLocalBazaarPackage(src, \"plugins\", true, frontend)\nif errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {\n    showIncompatibleNotice(pkg.MinAppVersion) // require SiYuan >= MinAppVersion\n}","handlingStrategy":"validation","validationCode":"function isCompatible(pkg, appVersion, frontend) {\n  if (compareVersions(appVersion, pkg.minAppVersion) < 0) return false;\n  if (pkg.type === \"plugins\" && !frontendSupported(pkg, frontend)) return false;\n  return true;\n}","typeGuard":"function isIncompatible(err) { return errors.Is(err, model.ErrLocalBazaarPackageIncompatible); }","tryCatchPattern":"_, err := model.InstallLocalBazaarPackage(src, pkgType, true, frontend)\nif errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {\n    notifyUser(\"requires newer SiYuan or unsupported frontend\")\n    return // skip, don't retry\n}","preventionTips":["Check pkg.MinAppVersion against the running app version before installing","Verify frontend compatibility (desktop vs mobile) for plugins","Surface the required version from the error message to the user instead of retrying blindly"],"tags":["marketplace","version-compatibility","sentinel-error","install"],"backgroundTag":"incompatible-source-type","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"}