siyuan-note/siyuan · error

request bazaar package rating failed: HTTP

Error message

request bazaar package rating failed: HTTP %d (%s)

What it means

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.

Solutions

  1. Retry after a short delay; most 5xx are transient
  2. Check SiYuan cloud service status / ld246.com announcements for outages
  3. Inspect kernel logs (LogWarnf line) for the request body/status to confirm which endpoint failed
  4. Update SiYuan if the server API version changed
Defensive patterns

Strategy: retry

Validate before calling

// cheap pre-check: connectivity to the cloud endpoint
const ok = await fetch("https://siyuan-note.com", {method:"HEAD"}).then(r=>r.ok).catch(()=>false);
if (!ok) deferRatingRequest();

Try / catch

try {
  await api.getBazaarPackageRating(pkgType, pkg);
} catch (e) {
  if (/HTTP \d+/.test(String(e.message))) {
    await sleep(retryDelay); // exponential backoff; 5xx usually transient
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: SiYuan cloud maintenance; reverse proxy 502 while the backend restarts; network middleboxes injecting HTML error pages.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/b2019eba3d393c29. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/bazaar_rating.go:390

		logging.LogWarnf("request bazaar package rating failed: %s", err)
		return ErrFailedToConnectCloudServer
	}
	if http.StatusUnauthorized == resp.StatusCode {
		invalidUser()
		return errors.New(Conf.Language(31))
	}
	if http.StatusTooManyRequests == resp.StatusCode {
		return ErrBazaarRatingRateLimited
	}
	if http.StatusOK != resp.StatusCode {
		if body, readErr := resp.ToBytes(); nil == readErr {
			_ = json.Unmarshal(body, &errorResult)
		}
		if http.StatusServiceUnavailable == resp.StatusCode && "bazaarPackagePending" == errorResult.Data.ErrorCode {
			return ErrBazaarPackagePending
		}
		logging.LogWarnf("request bazaar package rating [%s] failed: HTTP %d", body["packageName"], resp.StatusCode)
		return fmt.Errorf("request bazaar package rating failed: HTTP %d (%s)", resp.StatusCode, http.StatusText(resp.StatusCode))
	}
	if 0 != result.Code {
		if "" != result.Msg {
			return errors.New(result.Msg)
		}
		return errors.New("request bazaar package rating failed")
	}
	*data = result.Data
	return nil
}

func isValidBazaarPackageType(pkgType string) bool {
	switch pkgType {
	case "plugins", "widgets", "icons", "templates", "themes":
		return true
	default:
		return false
	}

View on GitHub (pinned to 9f775e8a12)