{"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/8641553a1f07374001902d3ce773285db1292b2d/kernel/bazaar/install.go#L44-L80","documentation":"downloadBazaarFile fetches package zips from the bazaar OSS CDN; when the response status is not 200 it returns this error with the HTTP status string appended (e.g. 'get bazaar package failed: 404 Not Found'). It signals the CDN answered but refused/failed the request.","triggerScenarios":"InstallPackage -> downloadBazaarFile with a repoURLHash whose package object is missing on the CDN (404), or CDN returning 403/5xx; the check `200 != resp.StatusCode` raises the error.","commonSituations":"Installing a plugin/theme pinned to a commit hash that was never published to the OSS store; CDN outage returning 5xx; repo or hash typo in a custom install call.","solutions":["Refresh the marketplace index and retry so the install uses a valid published repoHash","Check the appended HTTP status: 404 means the package/hash is not on the CDN — verify the repo URL and hash exist in the marketplace","Retry later on 5xx statuses (CDN-side problem)","Check kernel logs for 'get bazaar package [...]' with the failing status code to confirm which URL failed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check status yourself before consuming data\nresp, err := http.Get(u)\nif err == nil && resp.StatusCode != 200 {\n\treturn fmt.Errorf(\"package not available: %s\", resp.Status)\n}","typeGuard":null,"tryCatchPattern":"if err := InstallPackage(...); err != nil {\n\tif strings.HasPrefix(err.Error(), \"get bazaar package failed: \") {\n\t\tstatus := strings.TrimPrefix(err.Error(), \"get bazaar package failed: \")\n\t\tif strings.HasPrefix(status, \"5\") { retryLater() } else { reportBadPackage(status) }\n\t}\n\treturn err\n}","preventionTips":["Read the appended HTTP status to distinguish 404 (bad hash/package) from 5xx (CDN outage)","Refresh the marketplace index before installing so hashes are current","Retry only on 5xx; report persistent 404s as broken listings","Avoid hand-built repoURLHash values; use index-supplied hashes"],"tags":["http","marketplace","download","bazaar","cdn"],"backgroundTag":"http-error-response","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}