siyuan-note/siyuan · error

get bazaar package failed

Error message

get bazaar package failed: %s

What it means

The marketplace package download reached the OSS CDN but the response status was not 200; the returned error embeds resp.Status (e.g. "get bazaar package failed: 404 Not Found"). Unlike the transport failure, the server answered — the artifact for the exact owner/repo@hash was refused, missing, or rate-limited. The kernel log records the numeric code.

Solutions

  1. Read the embedded status: 404 means refresh metadata — update SiYuan / reload the marketplace so repo@hash matches what the CDN serves
  2. For 429/5xx, wait and retry later
  3. If the package version is gone, install from a local archive or wait for the package's next release
  4. Confirm the repo URL and hash in the log line match the package you intended

Example fix

// before - one shot, any failure retried blindly
if err := bazaar.InstallPackage(...); err != nil { retry() }
// after - branch on the embedded status
err := bazaar.InstallPackage(repoURL, hash, installPath, systemID, "plugin", name, false)
if err != nil && strings.Contains(err.Error(), "404") {
    refreshBazaarIndex() // stale hash: re-fetch metadata before trying again
} else if err != nil {
    retryWithBackoff()   // 429/5xx are worth retrying
}
Defensive patterns

Strategy: retry

Try / catch

err := bazaar.InstallPackage(repoURL, hash, installPath, systemID, pkgType, name, update)
if err != nil && strings.Contains(err.Error(), "get bazaar package failed: 404") {
    // hash no longer served: refresh marketplace metadata instead of retrying the same hash
} else if err != nil {
    // 429/5xx: retry later with backoff
}

Prevention

When it happens

Trigger: bazaar.InstallPackage with a repo@hash the CDN no longer serves (stale stage index after the package released a new version or was deleted), a 429 during marketplace traffic spikes, or a 5xx on the CDN.

Common situations: Outdated SiYuan holding an expired bazaar index whose hashes are gone from the CDN; package deleted upstream right after the listing was fetched; rate limiting during community events.

Related errors


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/0fbf3ddec74e6da5. Report an issue: GitHub.

Appendix: source

Thrown at kernel/bazaar/install.go:60

	repoURLHashTrimmed := strings.TrimPrefix(repoURLHash, "https://github.com/")
	v, err, _ := downloadPackageFlight.Do(repoURLHash, func() (any, error) {
		// repoURLHash: https://github.com/88250/Comfortably-Numb@6286912c381ef3f83e455d06ba4d369c498238dc 或带路径 /README.md
		repoURL := repoURLHash[:strings.LastIndex(repoURLHash, "@")]
		u := util.BazaarOSSServer + "/package/" + repoURLHashTrimmed
		buf := &bytes.Buffer{}
		resp, err := httpclient.NewCloudFileRequest2m().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) {
			if pushProgress {
				progress := float32(info.DownloadedSize) / float32(info.Response.ContentLength)
				util.PushDownloadProgress(repoURL, progress)
			}
		}).Get(u)
		if err != nil {
			logging.LogErrorf("get bazaar package [%s] failed: %s", u, err)
			return nil, errors.New("get bazaar package failed, please check your network")
		}
		if 200 != resp.StatusCode {
			logging.LogErrorf("get bazaar package [%s] failed: %d", u, resp.StatusCode)
			return nil, errors.New("get bazaar package failed: " + resp.Status)
		}
		data := buf.Bytes()
		return data, nil
	})
	if err != nil {
		return nil, err
	}
	return v.([]byte), nil
}

// incPackageDownloads 增加集市包下载次数
func incPackageDownloads(repoURL, packageName, systemID string) {
	if "" == systemID {
		return
	}
	repo := strings.TrimPrefix(repoURL, "https://github.com/")
	u := bazaarDownloadCloudServer() + "/apis/siyuan/bazaar/addBazaarPackageDownloadCount"
	httpclient.NewCloudRequest30s().SetBody(

View on GitHub (pinned to afa823b6b4)