siyuan-note/siyuan · error

%w: SiYuan %s or later is required

Error message

%w: SiYuan %s or later is required

What it means

InstallLocalBazaarPackage checks bazaar.IsBelowRequiredAppVersion(pkg): if the package manifest declares a MinAppVersion higher than the running SiYuan version, it returns ErrLocalBazaarPackageIncompatible wrapped as 'SiYuan %s or later is required' via %w, preserving errors.Is compatibility. A second branch returns the bare sentinel when the plugin/theme fails the frontend compatibility check (IsIncompatiblePlugin/IsIncompatibleTheme).

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 8641553a1f)

Solutions

  1. Upgrade SiYuan to the version named in the error message ('SiYuan X or later is required')
  2. Lower the package's minAppVersion only if you have verified it actually runs on the older version
  3. If the frontend-incompatible branch fired, use a package variant built for the current frontend (desktop/mobile)
  4. Match on errors.Is(err, model.ErrLocalBazaarPackageIncompatible) and parse the required version from the message for a user-facing prompt

Example fix

// before: plugin.json
{"name": "my-plugin", "minAppVersion": "3.3.0"} // running app is 3.1.9
// after
{"name": "my-plugin", "minAppVersion": "3.1.9"}
Defensive patterns

Strategy: try-catch

Validate before calling

const appVer = siyuanVersion; // running kernel version
const manifest = JSON.parse(readFileSync(path.join(src, pkgType === "plugins" ? "plugin.json" : "theme.json"), "utf8"));
if (manifest.minAppVersion && compareVersions(appVer, manifest.minAppVersion) < 0) {
  return upgradeFirst(manifest.minAppVersion);
}

Try / catch

try {
  await model.InstallLocalBazaarPackage(src, pkgType, frontend, overwrite);
} catch (err) {
  if (errors.Is(err, model.ErrLocalBazaarPackageIncompatible)) {
    // parse 'SiYuan X or later is required' from err and offer an upgrade link
  }
}

Prevention

When it happens

Trigger: Installing a local package whose theme.json/plugin.json sets minAppVersion above the current kernel version (e.g. '3.2.0' while running 3.1.x), or whose bazaar metadata marks it incompatible with the current frontend value.

Common situations: Developing a plugin against the latest SiYuan and installing it in an older workspace; local packages pulled from a newer release branch; reinstalling local packages after a SiYuan downgrade; desktop-only packages attempted on mobile frontend.

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@8641553a1f (2026-09-11). Data as JSON: /api/errors/b72d9c9a211c850b. Report an issue: GitHub.