siyuan-note/siyuan · error

marketplace package is not installed

Error message

marketplace package is not installed

What it means

Rating operations are restricted to packages actually installed in this workspace. validateBazaarPackageRatingRequest0 scans GetInstalledPackageInfos(pkgType) for a valid (InvalidReason == "") package whose Name equals packageName; if none is found, this error is returned without contacting the cloud.

Source

Thrown at kernel/model/bazaar_rating.go:238

	}
	token, err = bazaarRatingUserToken()
	if nil != err {
		return "", err
	}

	installedInfos, _, _, err := GetInstalledPackageInfos(pkgType)
	if nil != err {
		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

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Install the package first (or verify it appears in GetInstalledPackageInfos with an empty InvalidReason) before rating
  2. Ensure the pkgType argument matches the type the package is installed as
  3. Reload the installed-package list to refresh state after install/uninstall, then retry
  4. Check info.Pkg.InvalidReason for the package; fix the underlying load failure so it counts as validly installed

Example fix

// before: rating an uninstalled package
infos, _, _, _ := model.GetInstalledPackageInfos("plugins")
if len(infos) == 0 { return errors.New("plugin not installed") }
// after: verify the exact package is validly installed
installed := false
for _, info := range infos {
    if info.Pkg.InvalidReason == "" && info.Pkg.Name == packageName { installed = true; break }
}
if !installed { return errors.New("install the package before rating it") }
Defensive patterns

Strategy: validation

Validate before calling

installed := false
for _, info := range installedInfos {
    if info.Pkg.InvalidReason == "" && info.Pkg.Name == packageName { installed = true; break }
}
if !installed { return errors.New("install the package before rating it") }

Prevention

When it happens

Trigger: Calling GetBazaarPackageRating or SetBazaarPackageRating for a package name that is not currently installed, is installed but broken (non-empty InvalidReason), or is installed under a different pkgType than the one passed.

Common situations: Rating a package the user browsed in the marketplace but never installed; package was uninstalled while a rating UI was open; package failed to load (InvalidReason set) so it no longer counts as installed; passing "themes" while the package is installed as "plugins".

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/cdcb21571fcdd587. Report an issue: GitHub.