{"record":{"id":"0f87b962c9920b14","repo":"siyuan-note/siyuan","slug":"invalid-bazaar-index-generation-metadata","errorCode":null,"errorMessage":"invalid bazaar index generation metadata","messagePattern":"invalid bazaar index generation metadata","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/index.go","lineNumber":219,"sourceCode":"\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 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid bazaar index package: %s\", packageName)\n\t\t\t\t}\n\t\t\t\tif nil != pkg.Rating {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/bazaar/index.go#L201-L237","documentation":"Beyond schema >= 2, the index meta must carry a non-empty generation string and a publishedAt timestamp >= 1. If either is missing or empty, the parser rejects the index because generation metadata is what the client uses to identify and cache index generations reliably.","triggerScenarios":"parseBazaarIndex processes an index whose meta has schema >= 2 but meta.Generation is empty/whitespace or meta.PublishedAt is 0 or negative (typically because those fields were omitted in the published JSON).","commonSituations":"A bazaar publisher writing a new index format but forgetting the generation/publishedAt fields; hand-crafted or test index fixtures lacking meta fields; a template that initializes meta with zero values.","solutions":["Fix the index publisher to include a non-empty generation identifier and a positive Unix publishedAt timestamp in meta","Validate published index JSON against the expected meta shape before uploading (schema >= 2, generation non-empty, publishedAt >= 1)","If you maintain a mirror, regenerate the meta block from the upstream current-format index","Update test fixtures/mocks to include complete meta"],"exampleFix":"// before\n{\"meta\": {\"schema\": 2}}\n// after\n{\"meta\": {\"schema\": 2, \"generation\": \"gen-2026-09-11\", \"publishedAt\": 1757548800}}","handlingStrategy":"validation","validationCode":"// validate meta completeness before publishing\nif strings.TrimSpace(meta.Generation) == \"\" || meta.PublishedAt < 1 {\n    return errors.New(\"index meta needs non-empty generation and publishedAt >= 1\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid bazaar index generation metadata\") {\n    // serve cached snapshot; alert the index publisher\n}","preventionTips":["Always populate generation and publishedAt when constructing index meta; add a pre-upload validator","Use CI fixtures that assert the full meta block for every published index","Avoid hand-editing index JSON; generate meta programmatically with a real timestamp"],"tags":["marketplace","schema","metadata"],"backgroundTag":"missing-required-config-field","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}