{"record":{"id":"0fbf3ddec74e6da5","repo":"siyuan-note/siyuan","slug":"get-bazaar-package-failed-s","errorCode":null,"errorMessage":"get bazaar package failed: %s","messagePattern":"get bazaar package failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/install.go","lineNumber":60,"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":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/bazaar/install.go#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the embedded status: 404 means refresh metadata — update SiYuan / reload the marketplace so repo@hash matches what the CDN serves","For 429/5xx, wait and retry later","If the package version is gone, install from a local archive or wait for the package's next release","Confirm the repo URL and hash in the log line match the package you intended"],"exampleFix":"// before - one shot, any failure retried blindly\nif err := bazaar.InstallPackage(...); err != nil { retry() }\n// after - branch on the embedded status\nerr := bazaar.InstallPackage(repoURL, hash, installPath, systemID, \"plugin\", name, false)\nif err != nil && strings.Contains(err.Error(), \"404\") {\n    refreshBazaarIndex() // stale hash: re-fetch metadata before trying again\n} else if err != nil {\n    retryWithBackoff()   // 429/5xx are worth retrying\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := bazaar.InstallPackage(repoURL, hash, installPath, systemID, pkgType, name, update)\nif err != nil && strings.Contains(err.Error(), \"get bazaar package failed: 404\") {\n    // hash no longer served: refresh marketplace metadata instead of retrying the same hash\n} else if err != nil {\n    // 429/5xx: retry later with backoff\n}","preventionTips":["Update SiYuan / refresh the bazaar index before installing packages seen in a stale listing","Branch on the embedded HTTP status instead of retrying 404s blindly","Keep the repo@hash pair you installed from in logs for reproducible diagnostics"],"tags":["bazaar","marketplace","download","http-status","go"],"backgroundTag":"download-http-error","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}