siyuan-note/siyuan · error
invalid bazaar index schema
Error message
invalid bazaar index schema: %d
What it means
When the index payload contains a `meta` object, parseBazaarIndex requires meta.schema >= 2. A schema value of 0 or 1 (or a missing field, which unmarshals to 0) is considered a legacy or malformed index and is rejected with the offending schema number embedded in the message.
Solutions
- Regenerate the bazaar index with schema >= 2 in the meta object
- Re-fetch the index from the official bazaar endpoint instead of the stale mirror
- Update the test fixture to include "meta":{"schema":2}
Example fix
// before
{"meta":{"schema":1,"generation":"g1","publishedAt":1717000000},"packages":{}}
// after
{"meta":{"schema":2,"generation":"g1","publishedAt":1717000000},"packages":{}} Defensive patterns
Strategy: validation
Validate before calling
if (idx.meta === undefined || typeof idx.meta.schema !== "number" || idx.meta.schema < 2) throw new Error("index meta.schema must be >= 2") Prevention
- Keep index generators in sync with the minimum supported schema
- Pin mirrors to a bazaar release that emits schema >= 2
- Add a schema check to index CI before publishing
When it happens
Trigger: fetchBazaarIndexPath receives an index whose meta.schema is 0 or 1; an old cached index from before the schema-2 format; a hand-written fixture omitting meta.schema.
Common situations: Serving an outdated index snapshot from a mirror; rolling back a bazaar server to a pre-schema-2 release; testing with fixtures copied from old code.
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
- createDocTree document contains unknown field
- each key must be an object
- Field [ ] must not be empty
- incomplete bazaar index metadata
- invalid AI editor action data
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/5563f41878fb4258.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/bazaar/index.go:216
if err = json.Unmarshal(data, &raw); nil != err {
return nil, err
}
if nil == raw {
return nil, errors.New("invalid null bazaar index")
}
ret = &bazaarIndexSnapshot{
packages: map[string]*bazaarIndexPackage{},
legacyStats: map[string]*bazaarStats{},
}
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 {View on GitHub (pinned to 9f775e8a12)