siyuan-note/siyuan · error

built-in marketplace package cannot be overwritten

Error message

built-in marketplace package cannot be overwritten

What it means

InstallLocalBazaarPackage rejects uploaded local packages that would overwrite SiYuan's built-in themes or icons. These ship with the app and must not be replaced by marketplace imports, so installation is refused before any files are touched.

Solutions

  1. Rename the package in its package.json (name field) to something unique and rebuild the archive
  2. Install it only if you truly intend to replace stock assets — that path is blocked by design, so do not rename built-in files
  3. Distribute it as a regular marketplace-style package with a distinct name

Example fix

// before: package.json of a modified built-in theme
{ "name": "daylight", ... }
// after
{ "name": "daylight-customized", ... }
Defensive patterns

Strategy: validation

Validate before calling

func isBuiltInName(pkgType, name string) bool {
  if pkgType == "themes" { return model.IsBuiltInTheme(name) }
  if pkgType == "icons" { return model.IsBuiltInIcon(name) }
  return false
}
// call before InstallLocalBazaarPackage and reject early

Prevention

When it happens

Trigger: Importing a local .zip/.s2ip package whose package.json name equals a built-in theme (e.g. 'daylight', 'midnight') or built-in icon pack while pkgType is themes or icons.

Common situations: Repackaging a stock theme with modifications and trying to install it via the local-install dialog; a fork of a built-in theme kept the original name in package.json; automation scripts bulk-importing archives that collide with built-in names.

Related errors


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

Appendix: source

Thrown at kernel/model/bazaar.go:637

// InstallLocalBazaarPackage 安装上传的本地集市包。
func InstallLocalBazaarPackage(archivePath, frontend string, overwrite bool) (result *LocalBazaarPackageInstallResult, err error) {
	pkgType, pkg, sourcePath, cleanup, err := bazaar.ExtractLocalPackage(archivePath)
	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

View on GitHub (pinned to 9f775e8a12)