siyuan-note/siyuan · error · ErrLocalBazaarPackageIncompatible

: SiYuan or later is required

Error message

%w: SiYuan %s or later is required

What it means

InstallLocalBazaarPackage refuses packages whose declared MinAppVersion is newer than the running SiYuan, wrapping the sentinel ErrLocalBazaarPackageIncompatible with 'SiYuan <version> or later is required'. Callers can detect this case with errors.Is(err, model.ErrLocalBazaarPackageIncompatible).

Solutions

  1. Upgrade SiYuan to at least the required MinAppVersion shown in the error
  2. Ask the package author to lower minAppVersion if the dependency is not actually needed
  3. Check errors.Is(err, model.ErrLocalBazaarPackageIncompatible) in your caller to show a targeted message

Example fix

// before: treating all failures the same
if err := model.InstallLocalBazaarPackage(zipPath, frontend, false); err != nil { return err }
// after: detect incompatibility specifically
if err := model.InstallLocalBazaarPackage(zipPath, frontend, false); err != nil {
    if errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {
        return fmt.Errorf("please upgrade SiYuan: %v", err)
    }
    return err
}
Defensive patterns

Strategy: validation

Validate before calling

pkg, _ := bazaar.ParsePackageJSON(pkgJSONPath)
if pkg != nil && bazaar.IsBelowRequiredAppVersion(pkg) {
  return fmt.Errorf("needs SiYuan >= %s", pkg.MinAppVersion)
}

Try / catch

err := model.InstallLocalBazaarPackage(zip, frontend, false)
if errors.Is(err, model.ErrLocalBazaarPackageIncompatible) {
  return showUpgradeRequiredMessage(err)
}

Prevention

When it happens

Trigger: Installing a local package archive whose package.json sets minAppVersion above the current kernel version; installing an old package export into a freshly downgraded workspace.

Common situations: A plugin author bumped minAppVersion for a new API and users on older SiYuan try side-loading the archive; testing a package built for a dev/insider build on a stable install.

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/b72d9c9a211c850b. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/bazaar.go:640

	if err != nil {
		return nil, err
	}
	defer cleanup()

	result = &LocalBazaarPackageInstallResult{
		PackageType:   pkgType,
		PackageName:   pkg.Name,
		MinAppVersion: pkg.MinAppVersion,
	}
	installPath, _, err := getPackageInstallPath(pkgType, pkg.Name)
	if err != nil {
		return result, err
	}
	if (pkgType == "themes" && isBuiltInTheme(pkg.Name)) || (pkgType == "icons" && isBuiltInIcon(pkg.Name)) {
		return result, errors.New("built-in marketplace package cannot be overwritten")
	}
	if bazaar.IsBelowRequiredAppVersion(pkg) {
		return result, fmt.Errorf("%w: SiYuan %s or later is required", ErrLocalBazaarPackageIncompatible, pkg.MinAppVersion)
	}
	if (pkgType == "plugins" && bazaar.IsIncompatiblePlugin(pkg, frontend)) ||
		(pkgType == "themes" && bazaar.IsIncompatibleTheme(pkg, frontend)) {
		return result, ErrLocalBazaarPackageIncompatible
	}

	localBazaarInstallLock.Lock()
	defer localBazaarInstallLock.Unlock()
	containsFile, statErr := bazaar.PackageDirContainsFile(installPath)
	if statErr != nil && !os.IsNotExist(statErr) {
		return result, statErr
	}
	result.Updated = containsFile
	if result.Updated && !overwrite {
		return result, ErrLocalBazaarPackageExists
	}
	if err = bazaar.InstallLocalPackage(sourcePath, installPath, pkgType, pkg.Name, result.Updated); err != nil {
		return result, fmt.Errorf(Conf.Language(46), pkg.Name, err)

View on GitHub (pinned to 9f775e8a12)