siyuan-note/siyuan · error

get rhy result failed

Error message

get rhy result failed: %d

What it means

getRhyResult0 fetches version/marketplace metadata from the SiYuan rhy endpoint and fails when the HTTP response status is not 200. The formatted message includes the numeric status code so the caller can identify what the server returned.

Solutions

  1. Check the status code in the message: 429 means back off and retry later; 5xx means upstream outage
  2. Verify network/proxy connectivity to the SiYuan update endpoint
  3. Retry after a delay; the result is cached once a 200 is received
  4. If behind a firewall, allowlist the endpoint or use an environment with unrestricted access

Example fix

// before
rhy, err := util.GetRhyResult(false)
if err != nil { return err } // "get rhy result failed: 502"
// after
rhy, err := util.GetRhyResult(false)
if err != nil {
  logging.LogWarnf("rhy unavailable, using cached/default: %v", err)
  rhy = fallbackRhyResult // continue with degraded functionality
}
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(rhyURL)
if err != nil || resp.StatusCode != http.StatusOK {
  return errors.New("rhy endpoint unreachable or non-200; use cached result")
}

Try / catch

rhy, err := util.GetRhyResult(false)
if err != nil {
  logging.LogWarnf("rhy fetch failed (%v); falling back to cached result", err)
  rhy = cachedOrMinimalResult()
}
// schedule a retry with backoff for 429/5xx

Prevention

When it happens

Trigger: Any call that resolves the cached rhy result (version checks, marketplace/bazaar listings) when the remote server responds with a non-200 status such as 403, 429, 502, or 5xx.

Common situations: Rate limiting by the remote endpoint; CDN/proxy or firewall blocking requests; regional network issues; temporary upstream outages; corporate proxies returning 403/407.

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/5c0faf4c13ffae5d. Report an issue: GitHub.

Appendix: source

Thrown at kernel/util/rhy.go:86

	}
	ret := v.(map[string]any)
	syncRhyBazaarHashFromResult(ret)
	return ret, nil
}

func getRhyResult0(ctx context.Context) (map[string]any, error) {
	rhyResultLock.Lock()
	defer rhyResultLock.Unlock()

	request := httpclient.NewCloudRequest30s()
	resp, err := request.SetContext(ctx).SetSuccessResult(&cachedRhyResult).Get(GetCloudServer() + "/apis/siyuan/version?ver=" + Ver)
	if err != nil {
		logging.LogErrorf("get version info failed: %s", err)
		return nil, err
	}
	if 200 != resp.StatusCode {
		logging.LogErrorf("get rhy result failed: %d", resp.StatusCode)
		return nil, fmt.Errorf("get rhy result failed: %d", resp.StatusCode)
	}
	rhyResultCacheTime = time.Now().Unix()
	return cachedRhyResult, nil
}

func syncRhyBazaarHashFromResult(m map[string]any) {
	rhyBazaarHashLock.Lock()
	defer rhyBazaarHashLock.Unlock()
	if nil == m {
		rhyBazaarHash = ""
		return
	}
	v, ok := m["bazaar"]
	if !ok || nil == v {
		rhyBazaarHash = ""
		return
	}
	s, ok := v.(string)

View on GitHub (pinned to 9f775e8a12)