siyuan-note/siyuan · error
incomplete bazaar index metadata
Error message
incomplete bazaar index metadata
What it means
This error is thrown in two complementary cases: (1) the payload has meta with schema in the supported range (2..bazaarIndexSchema) but no `packages` key, or (2) the payload has a `packages` key but no `meta` key. A schema-2+ index must carry both meta and packages; either alone is incomplete.
Solutions
- Regenerate the index including both meta and packages top-level keys
- Re-fetch the index from the official endpoint
- Fix the fixture to include both keys
Example fix
// before
{"meta":{"schema":2,"generation":"g1","publishedAt":1789000000}}
// after
{"meta":{"schema":2,"generation":"g1","publishedAt":1789000000},"packages":{}} Defensive patterns
Strategy: validation
Validate before calling
if (!("meta" in idx) || !("packages" in idx)) throw new Error("index must contain both meta and packages") Prevention
- Validate the index template includes both required top-level keys
- Diff newly generated indexes against a schema checklist before publishing
- Avoid manual edits to cached index files
When it happens
Trigger: fetchBazaarIndexPath receives {"meta":{...}} without "packages", or {"packages":{...}} without "meta"; a truncated JSON object; a fixture with one of the two keys removed.
Common situations: An index builder dropped the packages section; an old format writer produced packages-only payloads; manual editing of a cached index removed a key.
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
- invalid bazaar index generation metadata
- createDocTree document title is required
- each key requires name and type
- event.data is required
- Field [conf] is required
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/6f8e5a6853c2feff.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/bazaar/index.go:225
}
metaRaw, hasMeta := raw["meta"]
packagesRaw, hasPackages := raw["packages"]
if hasMeta {
if err = json.Unmarshal(metaRaw, &ret.meta); nil != err {
return nil, err
}
if 2 > ret.meta.Schema {
return nil, fmt.Errorf("invalid bazaar index schema: %d", ret.meta.Schema)
}
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
}View on GitHub (pinned to 9f775e8a12)