{"record":{"id":"5563f41878fb4258","repo":"siyuan-note/siyuan","slug":"invalid-bazaar-index-schema-d","errorCode":null,"errorMessage":"invalid bazaar index schema: %d","messagePattern":"invalid bazaar index schema: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/index.go","lineNumber":216,"sourceCode":"\tif err = json.Unmarshal(data, &raw); nil != err {\n\t\treturn nil, err\n\t}\n\tif nil == raw {\n\t\treturn nil, errors.New(\"invalid null bazaar index\")\n\t}\n\tret = &bazaarIndexSnapshot{\n\t\tpackages:    map[string]*bazaarIndexPackage{},\n\t\tlegacyStats: map[string]*bazaarStats{},\n\t}\n\n\tmetaRaw, hasMeta := raw[\"meta\"]\n\tpackagesRaw, hasPackages := raw[\"packages\"]\n\tif hasMeta {\n\t\tif err = json.Unmarshal(metaRaw, &ret.meta); nil != err {\n\t\t\treturn nil, err\n\t\t}\n\t\tif 2 > ret.meta.Schema {\n\t\t\treturn nil, fmt.Errorf(\"invalid bazaar index schema: %d\", ret.meta.Schema)\n\t\t}\n\t\tif \"\" == strings.TrimSpace(ret.meta.Generation) || 1 > ret.meta.PublishedAt {\n\t\t\treturn nil, errors.New(\"invalid bazaar index generation metadata\")\n\t\t}\n\t\tif bazaarIndexSchema < ret.meta.Schema {\n\t\t\tret.meta.RatingsAvailable = false\n\t\t} else {\n\t\t\tif !hasPackages {\n\t\t\t\treturn nil, errors.New(\"incomplete bazaar index metadata\")\n\t\t\t}\n\t\t\tif err = json.Unmarshal(packagesRaw, &ret.packages); nil != err {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif nil == ret.packages {\n\t\t\t\treturn nil, errors.New(\"invalid bazaar index packages\")\n\t\t\t}\n\t\t\tfor packageName, pkg := range ret.packages {\n\t\t\t\tif !IsValidPackageName(packageName) || nil == pkg || !isValidBazaarRepo(pkg.Repo) || 0 > pkg.Downloads {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/bazaar/index.go#L198-L234","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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}"],"exampleFix":"// before\n{\"meta\":{\"schema\":1,\"generation\":\"g1\",\"publishedAt\":1717000000},\"packages\":{}}\n// after\n{\"meta\":{\"schema\":2,\"generation\":\"g1\",\"publishedAt\":1717000000},\"packages\":{}}","handlingStrategy":"validation","validationCode":"if (idx.meta === undefined || typeof idx.meta.schema !== \"number\" || idx.meta.schema < 2) throw new Error(\"index meta.schema must be >= 2\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["bazaar","schema","versioning","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}