{"record":{"id":"084604fefe4de0cc","repo":"siyuan-note/siyuan","slug":"get-bazaar-package-failed","errorCode":null,"errorMessage":"get bazaar package failed: ","messagePattern":"get bazaar package failed: ","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/install.go","lineNumber":62,"sourceCode":"\trepoURLHashTrimmed := strings.TrimPrefix(repoURLHash, \"https://github.com/\")\n\tv, err, _ := downloadPackageFlight.Do(repoURLHash, func() (any, error) {\n\t\t// repoURLHash: https://github.com/88250/Comfortably-Numb@6286912c381ef3f83e455d06ba4d369c498238dc 或带路径 /README.md\n\t\trepoURL := repoURLHash[:strings.LastIndex(repoURLHash, \"@\")]\n\t\tu := util.BazaarOSSServer + \"/package/\" + repoURLHashTrimmed\n\t\tbuf := &bytes.Buffer{}\n\t\tresp, err := httpclient.NewCloudFileRequest2m().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) {\n\t\t\tif pushProgress {\n\t\t\t\tprogress := float32(info.DownloadedSize) / float32(info.Response.ContentLength)\n\t\t\t\tutil.PushDownloadProgress(repoURL, progress)\n\t\t\t}\n\t\t}).Get(u)\n\t\tif err != nil {\n\t\t\tlogging.LogErrorf(\"get bazaar package [%s] failed: %s\", u, err)\n\t\t\treturn nil, errors.New(\"get bazaar package failed, please check your network\")\n\t\t}\n\t\tif 200 != resp.StatusCode {\n\t\t\tlogging.LogErrorf(\"get bazaar package [%s] failed: %d\", u, resp.StatusCode)\n\t\t\treturn nil, errors.New(\"get bazaar package failed: \" + resp.Status)\n\t\t}\n\t\tdata := buf.Bytes()\n\t\treturn data, nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn v.([]byte), nil\n}\n\n// incPackageDownloads 增加集市包下载次数\nfunc incPackageDownloads(repoURL, packageName, systemID string) {\n\tif \"\" == systemID {\n\t\treturn\n\t}\n\trepo := strings.TrimPrefix(repoURL, \"https://github.com/\")\n\tu := bazaarDownloadCloudServer() + \"/apis/siyuan/bazaar/addBazaarPackageDownloadCount\"\n\thttpclient.NewCloudRequest30s().SetBody(","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/bazaar/install.go#L44-L80","documentation":"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\").","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the appended status in the error message to identify the exact HTTP code","Refresh the marketplace index so package URLs point at current releases","For 403 rate-limit responses, wait and retry or configure an authenticated/tokenized endpoint","Check the package repo/release still publishes the expected asset"],"exampleFix":"// before: stale index URL -> \"get bazaar package failed: 404 Not Found\"\n// after: re-open marketplace to refresh index, then install the current package version","handlingStrategy":"retry","validationCode":"resp, err := http.Head(u)\nif err != nil || resp.StatusCode != 200 {\n    return fmt.Errorf(\"package URL not downloadable: %s\", http.StatusText(resp.StatusCode))\n}","typeGuard":null,"tryCatchPattern":"if err := install(...); strings.HasPrefix(err.Error(), \"get bazaar package failed: \") {\n    status := strings.TrimPrefix(err.Error(), \"get bazaar package failed: \")\n    switch {\n    case strings.HasPrefix(status, \"403\"):\n        // rate limited: wait, then retry\n    case strings.HasPrefix(status, \"404\"):\n        // refresh marketplace index to get a live URL\n    default:\n        // transient 5xx: retry with backoff\n    }\n}","preventionTips":["Refresh the marketplace index before installing to avoid stale asset URLs","Handle GitHub/CDN rate limits (authenticated endpoints or delays between installs)","Verify release assets exist after publishing a package"],"tags":["http","bazaar","download","http-status"],"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"}