siyuan-note/siyuan · error

marketplace package is not installed

Error message

marketplace package is not installed

What it means

validateBazaarPackageRatingRequest0 requires the package to be currently installed locally and structurally valid (empty InvalidReason) before rating operations are allowed (kernel/model/bazaar_rating.go:242-250). It scans GetInstalledPackageInfos(pkgType) for a matching name and returns this error when no installed, valid package matches packageName.

Solutions

  1. Install the package via the marketplace before rating it
  2. Verify pkgType matches the package's actual type (plugins vs themes vs icons etc.)
  3. Use the exact name from the installed package metadata (info.Pkg.Name), which also guarantees an empty InvalidReason
  4. If the package is installed but flagged, reinstall it to clear the InvalidReason and retry

Example fix

// before
infos, _, _, _ := model.GetInstalledPackageInfos("plugins")
_ = infos // rating attempted regardless
model.SetBazaarPackageRating(ctx, "plugins", "not-installed-plugin", 5)
// after
infos, _, _, _ := model.GetInstalledPackageInfos("plugins")
for _, info := range infos {
    if info.Pkg.Name == "target-plugin" && info.Pkg.InvalidReason == "" {
        model.SetBazaarPackageRating(ctx, "plugins", "target-plugin", 5)
    }
}
Defensive patterns

Strategy: validation

Validate before calling

infos, _, _, err := model.GetInstalledPackageInfos(pkgType)
if err != nil { return err }
installed := false
for _, info := range infos {
    if info.Pkg.Name == packageName && info.Pkg.InvalidReason == "" { installed = true; break }
}
if !installed { return fmt.Errorf("package %s is not installed (or has an invalid install)", packageName) }

Try / catch

_, _, _, err := model.SetBazaarPackageRating(ctx, pkgType, name, rating)
if err != nil && strings.Contains(err.Error(), "marketplace package is not installed") {
    return fmt.Errorf("install %s (%s) before rating it", name, pkgType)
}

Prevention

When it happens

Trigger: Calling GetBazaarPackageRating or SetBazaarPackageRating for a package that is not installed, was uninstalled, is installed under a different pkgType, or whose local install is flagged with a non-empty InvalidReason (broken/corrupt install).

Common situations: Rating a marketplace package by name from a script before installing it; the package was removed after the name was captured; pkgType/plugin mismatch (e.g. passing a theme name with pkgType="plugins"); a broken install leaving InvalidReason set.

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@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/cdcb21571fcdd587. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/bazaar_rating.go:250

	}
	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 9f775e8a12)