siyuan-note/siyuan · error
get stage index failed
Error message
get stage index failed
What it means
getStageIndex performs an HTTP GET against the bazaar OSS stage index URL for the given package type. When the response status code is not 200, it logs the status and throws 'get stage index failed' instead of returning a partially parsed index.
Solutions
- Check the logged URL and status code; test it directly in a browser or curl.
- Refresh the bazaar hash (re-fetch rhy) so the /bazaar@<hash>/ path exists on OSS.
- Verify the pkgType string matches the published stage JSON name (plural form, e.g. plugins, themes, icons, templates).
- Retry later if the OSS/CDN service is degraded.
Defensive patterns
Strategy: retry
Try / catch
index, err := getStageIndex(ctx, pkgType)
var httpErr *interface{ HTTPStatus() int }
if err != nil {
log.Printf("stage index fetch failed: %v", err)
// inspect logged URL/status, backoff, retry
} Prevention
- Verify pkgType strings are the plural file names published on OSS (plugins, themes, icons, templates).
- Confirm the bazaar hash is current — a stale hash 404s on OSS.
- Monitor bazaar OSS/CDN status; add retries for 5xx.
When it happens
Trigger: getStageRepoByURL or GetExistingBazaarPackageNames triggers getStageIndex and the request to util.BazaarOSSServer + "/bazaar@<hash>/stage/<pkgType>.json" returns a non-200 status (404 for a bad hash/pkgType, 403, 5xx, etc.).
Common situations: Stale or invalid bazaar hash producing a 404 for the stage JSON; CDN/OSS outage returning 5xx; typo'd or renamed package type (the JSON file uses plural pkgType names); rate limiting or region blocks.
Related errors
- get bazaar package failed, please check your network
- request bazaar package rating failed: HTTP
- unexpected status code
- authentication probe returned HTTP " + response.status
- bazaar hash not available
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/bcaf251b445c8aae.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/bazaar/stage.go:238
bazaarHash := util.GetRhyBazaarHash(ctx)
if "" == bazaarHash {
logging.LogErrorf("bazaar hash unavailable (rhy missing or invalid bazaar field)")
err = errors.New("bazaar hash not available")
return
}
ret = &StageIndex{}
request := httpclient.NewBrowserRequest()
u := util.BazaarOSSServer + "/bazaar@" + bazaarHash + "/stage/" + pkgType + ".json" // pkgType 单词为复数形式
resp, reqErr := request.SetContext(ctx).SetSuccessResult(ret).Get(u)
if nil != reqErr {
logging.LogErrorf("get community stage index [%s] failed: %s", u, reqErr)
err = reqErr
return
}
if 200 != resp.StatusCode {
logging.LogErrorf("get community stage index [%s] failed: %d", u, resp.StatusCode)
err = errors.New("get stage index failed")
return
}
for _, repo := range ret.Repos {
unescapePackageDisplayStrings(repo.Package)
}
bazaarMemMu.Lock()
stageIndexCache[pkgType] = ret
bazaarMemMu.Unlock()
return
}
// getStageRepoByURL 根据 pkgType 与 url(owner/repo@hash)获取 StageRepo
func getStageRepoByURL(ctx context.Context, pkgType, url string) *StageRepo {
stageIndex, _ := getStageIndex(ctx, pkgType)
if nil == stageIndex {
return nilView on GitHub (pinned to 9f775e8a12)