{"record":{"id":"426a4d92f073caac","repo":"siyuan-note/siyuan","slug":"official-marketplace-package-not-found","errorCode":null,"errorMessage":"official marketplace package not found","messagePattern":"official marketplace package not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/bazaar_rating.go","lineNumber":258,"sourceCode":"\t\treturn \"\", err\n\t}\n\tinstalled := false\n\tfor _, info := range installedInfos {\n\t\tif \"\" == info.Pkg.InvalidReason && packageName == info.Pkg.Name {\n\t\t\tinstalled = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !installed {\n\t\treturn \"\", errors.New(\"marketplace package is not installed\")\n\t}\n\n\texists, err := bazaar.HasBazaarPackage(ctx, pkgType, packageName)\n\tif nil != err {\n\t\treturn \"\", err\n\t}\n\tif !exists {\n\t\treturn \"\", errors.New(\"official marketplace package not found\")\n\t}\n\treturn token, nil\n}\n\nfunc getBazaarRatingUserToken() (string, error) {\n\tuser := Conf.GetUser()\n\tif nil == user || \"\" == user.UserToken {\n\t\treturn \"\", errors.New(Conf.Language(31))\n\t}\n\treturn user.UserToken, nil\n}\n\nfunc getInstalledOfficialBazaarPackageNames(ctx context.Context, pkgType string,\n\tpackageNames []string) ([]string, error) {\n\tif !isValidBazaarPackageType(pkgType) {\n\t\treturn nil, errors.New(\"invalid package type\")\n\t}\n\tinstalledInfos, _, _, err := bazaarRatingInstalledPackageInfos(pkgType)","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/bazaar_rating.go#L240-L276","documentation":"validateBazaarPackageRatingRequest checks that a marketplace package name/type combination refers to an official SiYuan marketplace package before issuing a rating token. bazaar.HasBazaarPackage is queried against the official marketplace; if the package is not found there, this error is returned so ratings cannot be posted for non-official packages.","triggerScenarios":"Calling GetBazaarPackageRating, SetBazaarPackageRating or the installed-ratings APIs with a pkgType/packageName that does not exist in the official marketplace, a typo'd package name, or a package that was removed/renamed upstream.","commonSituations":"Developers testing against locally built or self-published plugins that are not published to the official marketplace; stale package lists after a package was unpublished; network issues causing HasBazaarPackage to see an empty index (though that path returns the transport error instead).","solutions":["Verify pkgType is one of the valid bazaar package types (plugin/theme/icon/template/widget) and packageName matches the published name exactly","Check the package exists at the official marketplace (bazaar.siyuan-note.com) before calling rating APIs","Re-sync/refresh the marketplace index in SiYuan if the package was recently published"],"exampleFix":"// before\nvalidateBazaarPackageRatingRequest(ctx, \"plugins\", \"my-local-plugin\")\n// after\n// publish 'my-local-plugin' to the official marketplace, or use a package\n// name that exists there, e.g. \"siyuan-plugin-sample\"","handlingStrategy":"validation","validationCode":"const VALID_TYPES = new Set([\"plugin\",\"theme\",\"icon\",\"template\",\"widget\"]);\nif (!VALID_TYPES.has(pkgType)) throw new Error(`invalid pkgType: ${pkgType}`);\nif (!/^siyuan-[a-z]+-[\\w-]+$/.test(packageName)) throw new Error(`bad package name: ${packageName}`);\n// confirm existence first: POST /api/bazaar/getBazaarPackage with pkgType/packageName","typeGuard":null,"tryCatchPattern":"try {\n  await api.setBazaarPackageRating(pkgType, packageName, rating);\n} catch (e) {\n  if (String(e.message).includes(\"official marketplace package not found\")) {\n    console.warn(`package ${packageName} is not an official marketplace package`);\n  } else throw e;\n}","preventionTips":["Resolve package names from the marketplace listing API rather than hard-coding them","Check that the package is installed from the official marketplace, not sideloaded","Watch for unpublished/renamed packages when upgrading"],"tags":["bazaar","marketplace","validation"],"backgroundTag":"entity-not-found","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"}