{"record":{"id":"5c0faf4c13ffae5d","repo":"siyuan-note/siyuan","slug":"get-rhy-result-failed-d","errorCode":null,"errorMessage":"get rhy result failed: %d","messagePattern":"get rhy result failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/util/rhy.go","lineNumber":86,"sourceCode":"\t}\n\tret := v.(map[string]any)\n\tsyncRhyBazaarHashFromResult(ret)\n\treturn ret, nil\n}\n\nfunc getRhyResult0(ctx context.Context) (map[string]any, error) {\n\trhyResultLock.Lock()\n\tdefer rhyResultLock.Unlock()\n\n\trequest := httpclient.NewCloudRequest30s()\n\tresp, err := request.SetContext(ctx).SetSuccessResult(&cachedRhyResult).Get(GetCloudServer() + \"/apis/siyuan/version?ver=\" + Ver)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"get version info failed: %s\", err)\n\t\treturn nil, err\n\t}\n\tif 200 != resp.StatusCode {\n\t\tlogging.LogErrorf(\"get rhy result failed: %d\", resp.StatusCode)\n\t\treturn nil, fmt.Errorf(\"get rhy result failed: %d\", resp.StatusCode)\n\t}\n\trhyResultCacheTime = time.Now().Unix()\n\treturn cachedRhyResult, nil\n}\n\nfunc syncRhyBazaarHashFromResult(m map[string]any) {\n\trhyBazaarHashLock.Lock()\n\tdefer rhyBazaarHashLock.Unlock()\n\tif nil == m {\n\t\trhyBazaarHash = \"\"\n\t\treturn\n\t}\n\tv, ok := m[\"bazaar\"]\n\tif !ok || nil == v {\n\t\trhyBazaarHash = \"\"\n\t\treturn\n\t}\n\ts, ok := v.(string)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/util/rhy.go#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"Rate limiting by the remote endpoint; CDN/proxy or firewall blocking requests; regional network issues; temporary upstream outages; corporate proxies returning 403/407.","solutions":["Check the status code in the message: 429 means back off and retry later; 5xx means upstream outage","Verify network/proxy connectivity to the SiYuan update endpoint","Retry after a delay; the result is cached once a 200 is received","If behind a firewall, allowlist the endpoint or use an environment with unrestricted access"],"exampleFix":"// before\nrhy, err := util.GetRhyResult(false)\nif err != nil { return err } // \"get rhy result failed: 502\"\n// after\nrhy, err := util.GetRhyResult(false)\nif err != nil {\n  logging.LogWarnf(\"rhy unavailable, using cached/default: %v\", err)\n  rhy = fallbackRhyResult // continue with degraded functionality\n}","handlingStrategy":"retry","validationCode":"resp, err := http.Head(rhyURL)\nif err != nil || resp.StatusCode != http.StatusOK {\n  return errors.New(\"rhy endpoint unreachable or non-200; use cached result\")\n}","typeGuard":null,"tryCatchPattern":"rhy, err := util.GetRhyResult(false)\nif err != nil {\n  logging.LogWarnf(\"rhy fetch failed (%v); falling back to cached result\", err)\n  rhy = cachedOrMinimalResult()\n}\n// schedule a retry with backoff for 429/5xx","preventionTips":["Cache the last successful rhy result for offline/degraded use","Back off on 429 instead of hammering the endpoint","Allowlist the SiYuan update endpoints in restricted networks","Monitor status codes surfaced in kernel logs"],"tags":["network","http","version-check","marketplace"],"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"}