{"record":{"id":"b2019eba3d393c29","repo":"siyuan-note/siyuan","slug":"request-bazaar-package-rating-failed-http-d-s","errorCode":null,"errorMessage":"request bazaar package rating failed: HTTP %d (%s)","messagePattern":"request bazaar package rating failed: HTTP (.+?) \\((.+?)\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/bazaar_rating.go","lineNumber":390,"sourceCode":"\t\tlogging.LogWarnf(\"request bazaar package rating failed: %s\", err)\n\t\treturn ErrFailedToConnectCloudServer\n\t}\n\tif http.StatusUnauthorized == resp.StatusCode {\n\t\tinvalidUser()\n\t\treturn errors.New(Conf.Language(31))\n\t}\n\tif http.StatusTooManyRequests == resp.StatusCode {\n\t\treturn ErrBazaarRatingRateLimited\n\t}\n\tif http.StatusOK != resp.StatusCode {\n\t\tif body, readErr := resp.ToBytes(); nil == readErr {\n\t\t\t_ = json.Unmarshal(body, &errorResult)\n\t\t}\n\t\tif http.StatusServiceUnavailable == resp.StatusCode && \"bazaarPackagePending\" == errorResult.Data.ErrorCode {\n\t\t\treturn ErrBazaarPackagePending\n\t\t}\n\t\tlogging.LogWarnf(\"request bazaar package rating [%s] failed: HTTP %d\", body[\"packageName\"], resp.StatusCode)\n\t\treturn fmt.Errorf(\"request bazaar package rating failed: HTTP %d (%s)\", resp.StatusCode, http.StatusText(resp.StatusCode))\n\t}\n\tif 0 != result.Code {\n\t\tif \"\" != result.Msg {\n\t\t\treturn errors.New(result.Msg)\n\t\t}\n\t\treturn errors.New(\"request bazaar package rating failed\")\n\t}\n\t*data = result.Data\n\treturn nil\n}\n\nfunc isValidBazaarPackageType(pkgType string) bool {\n\tswitch pkgType {\n\tcase \"plugins\", \"widgets\", \"icons\", \"templates\", \"themes\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bazaar_rating.go#L372-L408","documentation":"When the cloud rating endpoint returns a non-OK, non-401/429 HTTP status (and it is not the 503 bazaarPackagePending case), the kernel logs a warning and fails with a formatted error carrying the status code and its reason phrase.","triggerScenarios":"Cloud server returns 500/502/503/504 (or any unexpected status) during GetBazaarPackageRating, SetBazaarPackageRating, or pending/status test calls — server outage, gateway errors, maintenance windows.","commonSituations":"SiYuan cloud maintenance; reverse proxy 502 while the backend restarts; network middleboxes injecting HTML error pages.","solutions":["Retry after a short delay; most 5xx are transient","Check SiYuan cloud service status / ld246.com announcements for outages","Inspect kernel logs (LogWarnf line) for the request body/status to confirm which endpoint failed","Update SiYuan if the server API version changed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// cheap pre-check: connectivity to the cloud endpoint\nconst ok = await fetch(\"https://siyuan-note.com\", {method:\"HEAD\"}).then(r=>r.ok).catch(()=>false);\nif (!ok) deferRatingRequest();","typeGuard":null,"tryCatchPattern":"try {\n  await api.getBazaarPackageRating(pkgType, pkg);\n} catch (e) {\n  if (/HTTP \\d+/.test(String(e.message))) {\n    await sleep(retryDelay); // exponential backoff; 5xx usually transient\n  } else throw e;\n}","preventionTips":["Implement exponential backoff for cloud rating calls","Watch SiYuan cloud status during maintenance windows","Log the kernel's LogWarnf output to correlate failures"],"tags":["http","network","cloud","bazaar"],"backgroundTag":"http-error-response","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"}