siyuan-note/siyuan · error
invalid bazaar index package
Error message
invalid bazaar index package: %s
What it means
Each entry in the packages map is validated: the key must be a valid package name (IsValidPackageName), the value must be non-nil, its repo must pass isValidBazaarRepo, and Downloads must be >= 0. The first entry failing any of these aborts parsing with the package name in the message, so a single bad package poisons the whole index.
Solutions
- Fix the offending package entry in the bazaar index generator (name, repo, downloads)
- Re-fetch the index after upstream repair
- Remove the invalid package entry from the test fixture
Example fix
// before
{"packages":{"bad pkg":{"repo":"https://github.com/o/r","downloads":-1}}}
// after
{"packages":{"good-pkg":{"repo":"o/r","downloads":10}}} Defensive patterns
Strategy: validation
Validate before calling
for (const [name, pkg] of Object.entries(idx.packages)) {
if (!/^[A-Za-z0-9-]+$/.test(name) || pkg == null || !/^[^/]+\/[^/]+$/.test(pkg.repo) || pkg.downloads < 0) throw new Error(`invalid package entry: ${name}`)
} Prevention
- Validate package names and repo slugs at package-registration time
- Never store repo fields as full URLs; use owner/repo
- Clamp or reject negative download counts at aggregation time
When it happens
Trigger: fetchBazaarIndexPath receives an index containing a package entry with an invalid name key, a null entry, a repo string that does not match owner/repo form, or a negative downloads count.
Common situations: An upstream package was renamed to a name violating the naming rules; a repo field contains a full URL instead of owner/repo; downloads metadata became negative after an aggregation bug.
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
- Field [ ] must not be empty
- incomplete bazaar index metadata
- invalid bazaar downloads
- invalid bazaar index generation metadata
- invalid bazaar index packages
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/0b27c96e275ecf74.
Report an issue: GitHub.
Appendix: 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 9f775e8a12)