siyuan-note/siyuan · warning · ErrLocalBazaarPackageIncompatible

marketplace package is incompatible

Error message

marketplace package is incompatible

What it means

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.

Solutions

  1. Upgrade SiYuan to at least the version stated in the error ("SiYuan %s or later is required")
  2. Install a version of the package compatible with the current frontend, or skip it on unsupported frontends
  3. Detect with errors.Is(err, model.ErrLocalBazaarPackageIncompatible) and surface a clear 'incompatible' message instead of a generic failure

Example fix

// before
_, err := model.InstallLocalBazaarPackage(src, "plugins", true, frontend)
// after
_, err := model.InstallLocalBazaarPackage(src, "plugins", true, frontend)
if errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {
    showIncompatibleNotice(pkg.MinAppVersion) // require SiYuan >= MinAppVersion
}
Defensive patterns

Strategy: validation

Validate before calling

function isCompatible(pkg, appVersion, frontend) {
  if (compareVersions(appVersion, pkg.minAppVersion) < 0) return false;
  if (pkg.type === "plugins" && !frontendSupported(pkg, frontend)) return false;
  return true;
}

Type guard

function isIncompatible(err) { return errors.Is(err, model.ErrLocalBazaarPackageIncompatible); }

Try / catch

_, err := model.InstallLocalBazaarPackage(src, pkgType, true, frontend)
if errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {
    notifyUser("requires newer SiYuan or unsupported frontend")
    return // skip, don't retry
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/171d94d3b617f5fb. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/bazaar.go:112

}

// ThemeInstallOptions 描述新安装主题后需要应用的外观模式
type ThemeInstallOptions struct {
	Mode   int
	ModeOS bool
}

// LocalBazaarPackageInstallResult 描述本地集市包的识别和安装结果。
type LocalBazaarPackageInstallResult struct {
	PackageType   string `json:"packageType"`
	PackageName   string `json:"packageName"`
	MinAppVersion string `json:"minAppVersion,omitempty"`
	Updated       bool   `json:"updated"`
}

var (
	ErrLocalBazaarPackageExists       = errors.New("marketplace package already exists")
	ErrLocalBazaarPackageIncompatible = errors.New("marketplace package is incompatible")
	localBazaarInstallLock            sync.Mutex
)

// updatePackages 更新一组集市包;同类型批量更新时,安装后处理只执行一次
func updatePackages(packages []*UpdatedPackage, pkgType string, successCount, failedCount *int, planned int) {
	items := make([]batchInstallItem, 0, len(packages))
	for _, updated := range packages {
		pkg := updated.Available
		meta, err := installBazaarPackage(pkgType, pkg.RepoURL, pkg.RepoHash, pkg.RepoRef, pkg.Name)
		if err != nil {
			logging.LogErrorf("update %s [%s] failed: %s", pkgType, pkg.Name, err)
			util.PushErrMsg(fmt.Sprintf(Conf.language(238), pkg.Name), 5000)
			*failedCount++
			continue
		}
		items = append(items, batchInstallItem{name: pkg.Name, meta: meta})
		*successCount++
		util.PushEndlessProgress(fmt.Sprintf(Conf.language(236), *successCount+*failedCount, planned, pkg.Name))

View on GitHub (pinned to 9f775e8a12)