siyuan-note/siyuan · error

bazaar hash not available

Error message

bazaar hash not available

What it means

getStageIndex fetches the community stage index from BazaarOSSServer using a hash obtained from util.GetRhyBazaarHash. If the rhy service response is missing or its bazaar field yields an empty hash, the library cannot build the index URL and throws 'bazaar hash not available'. This is a guard against proceeding with an unusable upstream address.

Solutions

  1. Check network connectivity to the rhy/bazaar servers and any proxy settings.
  2. Retry later — the rhy service may be temporarily down or returning bad data.
  3. Verify util.BazaarOSSServer / rhy endpoint configuration is correct and not pointed at a stale mirror.
Defensive patterns

Strategy: retry

Try / catch

names, err := GetExistingBazaarPackageNames(ctx, "plugins", pkgs)
if err != nil {
    log.Printf("stage index unavailable: %v", err)
    // backoff and retry
}

Prevention

When it happens

Trigger: getStageRepoByURL or GetExistingBazaarPackageNames calls getStageIndex while util.GetRhyBazaarHash(ctx) returns "" — the rhy endpoint was unreachable, returned invalid JSON, or omitted the bazaar field.

Common situations: Network outage or firewall blocking the rhy server; rhy service temporarily returning malformed data; offline development environment; DNS/proxy misconfiguration.

Related errors


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

Appendix: source

Thrown at kernel/bazaar/stage.go:224

// getStageIndexFromCache 仅从缓存获取 stage 索引,无缓存时返回 nil(读前根据 util 已同步的 bazaar hash 视情况清理缓存)
func getStageIndexFromCache(ctx context.Context, pkgType string) *StageIndex {
	applyBazaarCacheHash(ctx)
	bazaarMemMu.RLock()
	defer bazaarMemMu.RUnlock()
	return stageIndexCache[pkgType]
}

// getStageIndex 获取 stage 索引
func getStageIndex(ctx context.Context, pkgType string) (ret *StageIndex, err error) {
	if cached := getStageIndexFromCache(ctx, pkgType); nil != cached {
		ret = cached
		return
	}

	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 {

View on GitHub (pinned to 9f775e8a12)