siyuan-note/siyuan · error

get bazaar package failed:

Error message

get bazaar package failed: 

What it means

After the HTTP GET completes, the downloader checks the status code. Any non-200 response (404, 403, 5xx, redirects exhausted, etc.) aborts the download and returns an error containing the full HTTP status string (e.g. "get bazaar package failed: 404 Not Found").

Solutions

  1. Read the appended status in the error message to identify the exact HTTP code
  2. Refresh the marketplace index so package URLs point at current releases
  3. For 403 rate-limit responses, wait and retry or configure an authenticated/tokenized endpoint
  4. Check the package repo/release still publishes the expected asset

Example fix

// before: stale index URL -> "get bazaar package failed: 404 Not Found"
// after: re-open marketplace to refresh index, then install the current package version
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(u)
if err != nil || resp.StatusCode != 200 {
    return fmt.Errorf("package URL not downloadable: %s", http.StatusText(resp.StatusCode))
}

Try / catch

if err := install(...); strings.HasPrefix(err.Error(), "get bazaar package failed: ") {
    status := strings.TrimPrefix(err.Error(), "get bazaar package failed: ")
    switch {
    case strings.HasPrefix(status, "403"):
        // rate limited: wait, then retry
    case strings.HasPrefix(status, "404"):
        // refresh marketplace index to get a live URL
    default:
        // transient 5xx: retry with backoff
    }
}

Prevention

When it happens

Trigger: Requesting a package URL that returns a non-200 status — most commonly 404 for a removed/renamed release asset, 403 rate limiting from GitHub/CDN, or 5xx from the mirror.

Common situations: Package version pinned in index no longer exists on the hosting CDN, GitHub API rate limits without auth, mirror/CDN outage, typo'd or stale package URL cached from an old index.

Related errors


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

Appendix: source

Thrown at kernel/bazaar/install.go:62

	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 9f775e8a12)