{"record":{"id":"bcaf251b445c8aae","repo":"siyuan-note/siyuan","slug":"get-stage-index-failed","errorCode":null,"errorMessage":"get stage index failed","messagePattern":"get stage index failed","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/stage.go","lineNumber":238,"sourceCode":"\n\tbazaarHash := util.GetRhyBazaarHash(ctx)\n\tif \"\" == bazaarHash {\n\t\tlogging.LogErrorf(\"bazaar hash unavailable (rhy missing or invalid bazaar field)\")\n\t\terr = errors.New(\"bazaar hash not available\")\n\t\treturn\n\t}\n\tret = &StageIndex{}\n\trequest := httpclient.NewBrowserRequest()\n\tu := util.BazaarOSSServer + \"/bazaar@\" + bazaarHash + \"/stage/\" + pkgType + \".json\" // pkgType 单词为复数形式\n\tresp, reqErr := request.SetContext(ctx).SetSuccessResult(ret).Get(u)\n\tif nil != reqErr {\n\t\tlogging.LogErrorf(\"get community stage index [%s] failed: %s\", u, reqErr)\n\t\terr = reqErr\n\t\treturn\n\t}\n\tif 200 != resp.StatusCode {\n\t\tlogging.LogErrorf(\"get community stage index [%s] failed: %d\", u, resp.StatusCode)\n\t\terr = errors.New(\"get stage index failed\")\n\t\treturn\n\t}\n\n\tfor _, repo := range ret.Repos {\n\t\tunescapePackageDisplayStrings(repo.Package)\n\t}\n\n\tbazaarMemMu.Lock()\n\tstageIndexCache[pkgType] = ret\n\tbazaarMemMu.Unlock()\n\treturn\n}\n\n// getStageRepoByURL 根据 pkgType 与 url（owner/repo@hash）获取 StageRepo\nfunc getStageRepoByURL(ctx context.Context, pkgType, url string) *StageRepo {\n\tstageIndex, _ := getStageIndex(ctx, pkgType)\n\tif nil == stageIndex {\n\t\treturn nil","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/bazaar/stage.go#L220-L256","documentation":"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.","triggerScenarios":"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.).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"index, err := getStageIndex(ctx, pkgType)\nvar httpErr *interface{ HTTPStatus() int }\nif err != nil {\n    log.Printf(\"stage index fetch failed: %v\", err)\n    // inspect logged URL/status, backoff, retry\n}","preventionTips":["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."],"tags":["bazaar","http","network"],"backgroundTag":"http-non-200-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"}