siyuan-note/siyuan · error
invalid bazaar package rating
Error message
invalid bazaar package rating: %s
What it means
If a package entry carries a rating, it is passed through normalizePackageRating, which returns a validity flag. An unnormalizable rating (wrong shape, out-of-range values) aborts parsing with the package name in the message. Ratings are optional per package but must be well-formed when present.
Solutions
- Fix the rating object shape/values for the named package in the index generator
- Omit the rating field entirely for that package if no valid data exists
- Re-fetch the index after upstream repair
Example fix
// before
{"packages":{"pkg":{"repo":"o/r","downloads":5,"rating":{"stars":"many"}}}}
// after
{"packages":{"pkg":{"repo":"o/r","downloads":5,"rating":{"stars":4.5,"count":100}}}} Defensive patterns
Strategy: validation
Validate before calling
if (pkg.rating != null && !(typeof pkg.rating.stars === "number" && pkg.rating.stars >= 0 && pkg.rating.stars <= 5)) throw new Error("malformed rating") Prevention
- Omit the rating field when no valid rating data exists
- Keep the rating producer's schema aligned with normalizePackageRating's expectations
- Add rating shape tests to index generation CI
When it happens
Trigger: fetchBazaarIndexPath receives an index whose packages.<name>.rating has an unexpected shape (e.g. wrong field types, star counts out of range) so normalizePackageRating reports invalid.
Common situations: An index generator changed its rating schema; a hand-edited fixture has a malformed rating object; a partially upgraded server emits ratings in the old format.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Account authentication failed, please login again
- attr must be a string or null (got %T)
- block [ ] type is locked: expected , got
- createDocTree definition must be a list
- createDocTree document must be a dictionary
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/502975cd053f6224.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/bazaar/index.go:240
ret.meta.RatingsAvailable = false
} else {
if !hasPackages {
return nil, errors.New("incomplete bazaar index metadata")
}
if err = json.Unmarshal(packagesRaw, &ret.packages); nil != err {
return nil, err
}
if nil == ret.packages {
return nil, errors.New("invalid bazaar index packages")
}
for packageName, pkg := range ret.packages {
if !IsValidPackageName(packageName) || nil == pkg || !isValidBazaarRepo(pkg.Repo) || 0 > pkg.Downloads {
return nil, fmt.Errorf("invalid bazaar index package: %s", packageName)
}
if nil != pkg.Rating {
rating, valid := normalizePackageRating(pkg.Rating)
if !valid {
return nil, fmt.Errorf("invalid bazaar package rating: %s", packageName)
}
pkg.Rating = rating
}
}
}
} else if hasPackages {
return nil, errors.New("incomplete bazaar index metadata")
}
if !hasMeta || 2 == ret.meta.Schema || bazaarIndexSchema < ret.meta.Schema {
for rawRepo, rawStats := range raw {
if "meta" == rawRepo || "packages" == rawRepo {
continue
}
repo, valid := normalizeLegacyBazaarRepo(rawRepo)
if !valid {
return nil, fmt.Errorf("invalid bazaar repository: %s", rawRepo)
}View on GitHub (pinned to 9f775e8a12)