siyuan-note/siyuan · warning · ErrBazaarRatingRateLimited
bazaar rating rate limited
Error message
bazaar rating rate limited
What it means
ErrBazaarRatingRateLimited is the sentinel error returned when the cloud rating service rejects a rating request because the client exceeded its frequency limit. The API layer maps it via errors.Is to the structured code 'bazaarRatingRateLimited' (apicontract.BazaarRatingError) instead of a generic failure, so clients can show a rate-limit message and back off.
Solutions
- Back off and retry the rating request after a delay (minutes, not seconds)
- Check errors.Is(err, model.ErrBazaarRatingRateLimited) and map it to the bazaarRatingRateLimited API code rather than a generic error
- Cache the rating response client-side instead of re-requesting per render
- Stop scripted polling loops against the rating endpoints
Example fix
// before: generic handling loses the rate-limit signal
if err := model.RequestBazaarPackageRating(ctx, pkgType, pkgName); err != nil { return err }
// after: recognize rate limiting
if err := model.RequestBazaarPackageRating(ctx, pkgType, pkgName); err != nil {
if errors.Is(err, model.ErrBazaarRatingRateLimited) {
return backoffAndRetry(err, 5*time.Minute)
}
return err
} Defensive patterns
Strategy: retry
Validate before calling
// throttle client-side: at most one rating request per minute
if time.Since(lastRatingRequest) < time.Minute { return ErrBackoff } Type guard
var rateLimited bool = errors.Is(err, model.ErrBazaarRatingRateLimited)
Try / catch
err := requestBazaarPackageRating(ctx, pkgType, name)
if errors.Is(err, model.ErrBazaarRatingRateLimited) {
return retryAfter(err, 5*time.Minute) // exponential backoff
} Prevention
- Cache rating responses instead of re-fetching per render
- Apply exponential backoff on all rating endpoints
- Avoid scripted loops hitting rating APIs; batch with delays
- Map the sentinel to bazaarRatingRateLimited so clients can react specifically
When it happens
Trigger: Requesting or setting a marketplace package rating (requestBazaarPackageRating / setBazaarPackageRatingError paths) after the user already submitted ratings recently; automated scripts polling rating endpoints in a loop; multiple devices sharing one cloud account ID hitting the same quota.
Common situations: A user toggling star ratings back and forth rapidly in the marketplace panel; CI or tooling iterating packages and fetching ratings for each; retry storms after transient network errors without backoff.
Related errors
- bazaarRatingRateLimited
- bazaar package information has not synced yet
- invalid rating distribution returned by cloud server
- localized please-sign-in message (Conf.Language(31))
- marketplace package ratings are unavailable
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/781796b7e95f5a4c.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/bazaar_rating.go:68
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")
// ErrBazaarPackagePending 表示云端尚未同步包信息。
var ErrBazaarPackagePending = errors.New("bazaar package information has not synced yet")
// 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")
}View on GitHub (pinned to 9f775e8a12)