siyuan-note/siyuan · error
invalid user rating returned by cloud server
Error message
invalid user rating returned by cloud server
What it means
GetBazaarPackageRating validates the cloud's response: the returned user rating must be within 0..5. If the cloud server returns a rating outside that range, the client rejects the response as corrupt/untrusted rather than propagating bad data.
Solutions
- Retry the request; a single malformed response may be transient
- Verify which cloud server/region is configured and whether it matches the client version
- Report the issue with the raw response so the cloud bug can be fixed
Defensive patterns
Strategy: validation
Validate before calling
if userRating < 0 || userRating > 5 {
return errors.New("rating from cloud outside 0..5")
} Try / catch
// Go
rating, avail, userRating, err := model.GetBazaarPackageRating(ctx, pkgType, name)
if err != nil {
// includes 'invalid user rating returned by cloud server'
return fmt.Errorf("fetch rating failed: %w", err)
} Prevention
- Validate cloud payloads at the boundary before applying them
- Pin client and cloud API versions to compatible releases
- Log raw responses when validation fails to ease diagnosis
When it happens
Trigger: Calling GetBazaarPackageRating (or the batched requestBazaarPackageUserRatings worker) when the cloud response body contains data.rating < 0 or > 5.
Common situations: Cloud API schema change or regression; a middleman/proxy altering the response; region-specific cloud deployments returning unexpected payloads.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- invalid public rating returned by cloud server
- 106
- 199
- -2
- Account authentication failed, please login again
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/6bd1b2f68e53fafd.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/bazaar_rating.go:143
// GetBazaarPackageRating 获取已安装官方包的公开评分和当前用户评分。
func GetBazaarPackageRating(ctx context.Context, pkgType, packageName string) (rating *bazaar.PackageRating,
ratingAvailable bool, userRating int, err error) {
token, err := bazaarRatingValidatePackage(ctx, pkgType, packageName)
if nil != err {
return nil, false, 0, err
}
data := bazaarPackageUserRatingData{}
err = requestBazaarPackageRating(ctx, "/apis/siyuan/bazaar/getBazaarPackageRating", map[string]any{
"token": token,
"packageName": packageName,
}, &data)
if nil != err {
return nil, false, 0, err
}
if 0 > data.Rating || 5 < data.Rating {
return nil, false, 0, errors.New("invalid user rating returned by cloud server")
}
rating, ratingAvailable = bazaar.GetBazaarPackageRating(ctx, packageName)
return rating, ratingAvailable, data.Rating, nil
}
// SetBazaarPackageRating 设置或取消已安装官方包的当前用户评分。
func SetBazaarPackageRating(ctx context.Context, pkgType, packageName string, userRating int) (rating *bazaar.PackageRating,
ratingAvailable bool, retUserRating int, err error) {
if 0 > userRating || 5 < userRating {
return nil, false, 0, errors.New("rating must be an integer from 0 to 5")
}
bazaarRatingSetMu.Lock()
defer bazaarRatingSetMu.Unlock()
token, err := bazaarRatingValidatePackage(ctx, pkgType, packageName)
if nil != err {
return nil, false, 0, errView on GitHub (pinned to 9f775e8a12)