{"record":{"id":"8c3a00ec04095455","repo":"siyuan-note/siyuan","slug":"bazaar-package-information-has-not-synced-yet","errorCode":null,"errorMessage":"bazaar package information has not synced yet","messagePattern":"bazaar package information has not synced yet","errorType":"exception","errorClass":"ErrBazaarPackagePending","httpStatus":null,"severity":"warning","filePath":"kernel/model/bazaar_rating.go","lineNumber":71,"sourceCode":"\tData T      `json:\"data\"`\n}\n\ntype bazaarPackageUserRatingData struct {\n\tRating int `json:\"rating\"`\n}\n\ntype bazaarPackageSetRatingData struct {\n\tRating          int                   `json:\"rating\"`\n\tRatingAvailable *bool                 `json:\"ratingAvailable\"`\n\tPublicRating    *bazaar.PackageRating `json:\"publicRating\"`\n\tDistribution    []int64               `json:\"distribution\"`\n}\n\n// ErrBazaarRatingRateLimited 表示评分请求受到云端频率限制。\nvar ErrBazaarRatingRateLimited = errors.New(\"bazaar rating rate limited\")\n\n// ErrBazaarPackagePending 表示云端尚未同步包信息。\nvar ErrBazaarPackagePending = errors.New(\"bazaar package information has not synced yet\")\n\n// GetInstalledBazaarPackageRatings 获取指定已安装包的公开评分。\nfunc GetInstalledBazaarPackageRatings(ctx context.Context, pkgType string,\n\tpackageNames []string) (ratings map[string]*bazaar.PackageRating, eligiblePackageNames []string, err error) {\n\teligiblePackageNames, err = getInstalledOfficialBazaarPackageNames(ctx, pkgType, packageNames)\n\tif nil != err {\n\t\treturn nil, nil, err\n\t}\n\tif 0 == len(eligiblePackageNames) {\n\t\treturn map[string]*bazaar.PackageRating{}, []string{}, nil\n\t}\n\tratings, available := bazaarRatingPublicPackageRatings(ctx, eligiblePackageNames)\n\tif !available {\n\t\treturn nil, nil, errors.New(\"marketplace package ratings are unavailable\")\n\t}\n\treturn ratings, eligiblePackageNames, nil\n}\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bazaar_rating.go#L53-L89","documentation":"ErrBazaarPackagePending is a sentinel error indicating the cloud server has not yet synchronized the bazaar package's information, so the rating request cannot be served. It is returned by requestBazaarPackageRating when the cloud responds HTTP 503 with errorCode 'bazaarPackagePending', and the API layer maps it to the 'bazaarPackagePending' error code.","triggerScenarios":"Calling GetBazaarPackageRating, SetBazaarPackageRating, or requestBazaarPackageRating for a package whose info has not yet reached the cloud rating service; the cloud replies 503 Service Unavailable with errorCode=bazaarPackagePending.","commonSituations":"A package was just published or installed and the cloud-side rating record has not propagated yet; a newly synced marketplace backend; stale cloud cache after a package rename.","solutions":["Wait and retry the rating request after the cloud has finished syncing the package","Check errors.Is(err, model.ErrBazaarPackagePending) and treat it as a transient 'no rating yet' state instead of a hard failure","Retry with exponential backoff via a bounded retry loop around the call"],"exampleFix":"// before\nrating, avail, userRating, err := model.GetBazaarPackageRating(ctx, pkgType, name)\nif err != nil { return err }\n// after\nrating, avail, userRating, err := model.GetBazaarPackageRating(ctx, pkgType, name)\nif errors.Is(err, model.ErrBazaarPackagePending) {\n    // package info not synced yet; show 'no rating'\n    return nil\n} else if err != nil {\n    return err\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go\nif errors.Is(err, model.ErrBazaarPackagePending) {\n    // transient: show 'not rated yet', schedule a retry with backoff\n}","preventionTips":["Treat bazaarPackagePending as a transient state in UI code via errors.Is","Add exponential backoff retries around rating calls","Only request ratings for packages that have been published for some time"],"tags":["cloud","marketplace","sync","transient"],"backgroundTag":"upstream-api-error","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}