siyuan-note/siyuan · error
invalid bazaar index package: %s
Error message
invalid bazaar index package: %s
What it means
Each entry of the packages map must have a valid package name, a non-nil package object, a well-formed repo (owner/repo in the allowed bazaar set), and non-negative downloads. The first entry violating any of these aborts the whole parse with the offending package name embedded in the message — the index is treated as trusted data and one bad entry invalidates it entirely.
Source
Thrown at kernel/bazaar/index.go:235
}
if "" == strings.TrimSpace(ret.meta.Generation) || 1 > ret.meta.PublishedAt {
return nil, errors.New("invalid bazaar index generation metadata")
}
if bazaarIndexSchema < ret.meta.Schema {
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 {
continueView on GitHub (pinned to 8641553a1f)
Solutions
- Identify the offending package from the message and fix its index entry server-side (correct repo string, non-negative downloads, non-null object)
- Check the publisher's stats pipeline for how downloads could go negative and clamp at 0
- Ensure every listed repo is a valid bazaar repo (correct owner/repo form accepted by isValidBazaarRepo)
- If it is a test fixture problem, regenerate fixtures with valid names/repos
Example fix
// index entry, before
"my-plugin": {"repo": "wrong-owner/my-plugin", "downloads": -3}
// after
"my-plugin": {"repo": "owner/my-plugin", "downloads": 0} Defensive patterns
Strategy: validation
Validate before calling
// validate each package entry before publishing
for name, pkg := range packages {
if !IsValidPackageName(name) || pkg == nil || !isValidBazaarRepo(pkg.Repo) || pkg.Downloads < 0 {
return fmt.Errorf("bad index entry: %s", name)
}
} Try / catch
if err != nil {
var m string
if fmt.Sprint(err) != "" && strings.HasPrefix(fmt.Sprint(err), "invalid bazaar index package:") {
name := strings.TrimPrefix(fmt.Sprint(err), "invalid bazaar index package: ")
// quarantine/name the offending package in monitoring
}
_ = m
} Prevention
- Run the same validation (IsValidPackageName, isValidBazaarRepo, downloads >= 0) on the server before publishing
- Clamp download counters at zero to prevent negative values from stats bugs
- Keep the package registry (names, repo slugs) consistent with what isValidBazaarRepo accepts
When it happens
Trigger: parseBazaarIndex iterates ret.packages and hits an entry where the key fails IsValidPackageName, the value is null, pkg.Repo fails isValidBazaarRepo (wrong owner/repo format or unexpected host), or pkg.Downloads < 0.
Common situations: A package published with a renamed/invalid repo slug; negative download counts from a stats-corruption bug on the server; a null entry produced by a serialization bug; unicode or path-like names that fail the package-name validation.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- invalid null bazaar index
- incomplete bazaar index metadata
- invalid bazaar package rating: %s
- invalid bazaar repository: %s
- invalid bazaar downloads: %s
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/0b27c96e275ecf74.
Report an issue: GitHub.