siyuan-note/siyuan · warning · ErrBazaarRatingRateLimited

bazaar rating rate limited

Error message

bazaar rating rate limited

What it means

ErrBazaarRatingRateLimited is a sentinel error (errors.New) declared in bazaar_rating.go indicating the cloud rating service rejected the request due to frequency limits. The API layer detects it with errors.Is and attaches errorCode 'bazaarRatingRateLimited' to the response so clients can show a rate-limit notice instead of a generic failure.

Source

Thrown at kernel/model/bazaar_rating.go:67

type bazaarRatingCloudResult[T any] struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data T      `json:"data"`
}

type bazaarPackageUserRatingData struct {
	Rating int `json:"rating"`
}

type bazaarPackageSetRatingData struct {
	Rating          int                   `json:"rating"`
	RatingAvailable *bool                 `json:"ratingAvailable"`
	PublicRating    *bazaar.PackageRating `json:"publicRating"`
	Distribution    []int64               `json:"distribution"`
}

// ErrBazaarRatingRateLimited 表示评分请求受到云端频率限制。
var ErrBazaarRatingRateLimited = errors.New("bazaar rating rate limited")

// GetInstalledBazaarPackageRatings 获取指定已安装包的公开评分。
func GetInstalledBazaarPackageRatings(ctx context.Context, pkgType string,
	packageNames []string) (ratings map[string]*bazaar.PackageRating, eligiblePackageNames []string, err error) {
	eligiblePackageNames, err = getInstalledOfficialBazaarPackageNames(ctx, pkgType, packageNames)
	if nil != err {
		return nil, nil, err
	}
	if 0 == len(eligiblePackageNames) {
		return map[string]*bazaar.PackageRating{}, []string{}, nil
	}
	ratings, available := bazaarRatingPublicPackageRatings(ctx, eligiblePackageNames)
	if !available {
		return nil, nil, errors.New("marketplace package ratings are unavailable")
	}
	return ratings, eligiblePackageNames, nil
}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Back off and retry after a delay; do not retry immediately in a loop.
  2. Respect the errorCode 'bazaarRatingRateLimited' in API responses and surface a cooldown message to users.
  3. Batch or debounce rating actions in the client instead of sending per-keystroke requests.
  4. Check the cloud service status if the limit appears to persist abnormally long.

Example fix

// before: immediate retry loop
for { err := model.SetBazaarPackageRating(ctx, pkg, stars); if err == nil { break } }
// after: back off on the sentinel
if errors.Is(err, model.ErrBazaarRatingRateLimited) {
    time.Sleep(30 * time.Second)
    continue
}
Defensive patterns

Strategy: retry

Type guard

// Go: detect the sentinel
isRateLimited := errors.Is(err, model.ErrBazaarRatingRateLimited)

Try / catch

if errors.Is(err, model.ErrBazaarRatingRateLimited) {
    time.Sleep(backoff)
    return retry()
}

Prevention

When it happens

Trigger: Calling setBazaarPackageRating / requestBazaarPackageRating (via kernel/api/bazaar.go rating endpoints) too frequently; the cloud backend returns a rate-limit signal and the kernel maps it to this sentinel error.

Common situations: UI auto-retrying rating submissions; scripted clients hammering the rating endpoint; multiple rating actions issued in quick succession from several windows/devices on the same account.

Related errors


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