siyuan-note/siyuan · error

official marketplace package not found

Error message

official marketplace package not found

What it means

validateBazaarPackageRatingRequest checks that a marketplace package name/type combination refers to an official SiYuan marketplace package before issuing a rating token. bazaar.HasBazaarPackage is queried against the official marketplace; if the package is not found there, this error is returned so ratings cannot be posted for non-official packages.

Solutions

  1. Verify pkgType is one of the valid bazaar package types (plugin/theme/icon/template/widget) and packageName matches the published name exactly
  2. Check the package exists at the official marketplace (bazaar.siyuan-note.com) before calling rating APIs
  3. Re-sync/refresh the marketplace index in SiYuan if the package was recently published

Example fix

// before
validateBazaarPackageRatingRequest(ctx, "plugins", "my-local-plugin")
// after
// publish 'my-local-plugin' to the official marketplace, or use a package
// name that exists there, e.g. "siyuan-plugin-sample"
Defensive patterns

Strategy: validation

Validate before calling

const VALID_TYPES = new Set(["plugin","theme","icon","template","widget"]);
if (!VALID_TYPES.has(pkgType)) throw new Error(`invalid pkgType: ${pkgType}`);
if (!/^siyuan-[a-z]+-[\w-]+$/.test(packageName)) throw new Error(`bad package name: ${packageName}`);
// confirm existence first: POST /api/bazaar/getBazaarPackage with pkgType/packageName

Try / catch

try {
  await api.setBazaarPackageRating(pkgType, packageName, rating);
} catch (e) {
  if (String(e.message).includes("official marketplace package not found")) {
    console.warn(`package ${packageName} is not an official marketplace package`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling GetBazaarPackageRating, SetBazaarPackageRating or the installed-ratings APIs with a pkgType/packageName that does not exist in the official marketplace, a typo'd package name, or a package that was removed/renamed upstream.

Common situations: Developers testing against locally built or self-published plugins that are not published to the official marketplace; stale package lists after a package was unpublished; network issues causing HasBazaarPackage to see an empty index (though that path returns the transport error instead).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/bazaar_rating.go:258

		return "", err
	}
	installed := false
	for _, info := range installedInfos {
		if "" == info.Pkg.InvalidReason && packageName == info.Pkg.Name {
			installed = true
			break
		}
	}
	if !installed {
		return "", errors.New("marketplace package is not installed")
	}

	exists, err := bazaar.HasBazaarPackage(ctx, pkgType, packageName)
	if nil != err {
		return "", err
	}
	if !exists {
		return "", errors.New("official marketplace package not found")
	}
	return token, nil
}

func getBazaarRatingUserToken() (string, error) {
	user := Conf.GetUser()
	if nil == user || "" == user.UserToken {
		return "", errors.New(Conf.Language(31))
	}
	return user.UserToken, nil
}

func getInstalledOfficialBazaarPackageNames(ctx context.Context, pkgType string,
	packageNames []string) ([]string, error) {
	if !isValidBazaarPackageType(pkgType) {
		return nil, errors.New("invalid package type")
	}
	installedInfos, _, _, err := bazaarRatingInstalledPackageInfos(pkgType)

View on GitHub (pinned to 9f775e8a12)