siyuan-note/siyuan · error

get bazaar package failed: %s

Error message

get bazaar package failed: %s

What it means

Returned by downloadBazaarFile (kernel/bazaar/install.go:57-59) when the HTTP request completed successfully but the response status code is not 200. The error message is dynamically constructed with resp.Status (e.g. "get bazaar package failed: 404 Not Found"). The underlying status code is logged via LogErrorf. Unlike error 128, this means the server was reached but returned an error response.

Source

Thrown at kernel/bazaar/install.go:59

	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, systemID string) {
	if "" == systemID {
		return
	}
	repo := strings.TrimPrefix(repoURL, "https://github.com/")
	u := util.GetCloudServer() + "/apis/siyuan/bazaar/addBazaarPackageDownloadCount"
	httpclient.NewCloudRequest30s().SetBody(

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Verify the repoURL and repoHash are correct and the package still exists on the bazaar
  2. Retry on 5xx/429 responses — these are typically transient
  3. Check the bazaar marketplace listing to confirm the package is still available
  4. If 404, the package may have been removed by its author — look for an alternative
Defensive patterns

Strategy: try-catch

Try / catch

err := bazaar.InstallPackage(repoURL, repoHash, installPath, systemID, pkgType, packageName, update)
if err != nil {
    msg := err.Error()
    if strings.Contains(msg, "404") {
        // Package not found — do not retry, prompt user to check the package URL
        return fmt.Errorf("package not found on bazaar server, verify repo URL and hash")
    }
    if strings.Contains(msg, "get bazaar package failed:") {
        // Non-200 response — retry on 5xx/429
        time.Sleep(5 * time.Second)
        return bazaar.InstallPackage(repoURL, repoHash, installPath, systemID, pkgType, packageName, update)
    }
    return err
}

Prevention

When it happens

Trigger: Calling InstallPackage when the bazaar OSS server responds with a non-200 status for the requested package URL — 404 if the package/hash is unknown, 5xx for server errors, 429 for rate limiting.

Common situations: Package repo/hash was deleted or renamed (404); bazaar OSS server is overloaded (5xx); CDN rate limiting (429); incorrect repoURL or repoHash passed to InstallPackage.

Related errors


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