siyuan-note/siyuan · error

invalid bazaar index generation metadata

Error message

invalid bazaar index generation metadata

What it means

After the schema check passes, parseBazaarIndex validates that meta.generation is a non-blank string and meta.publishedAt is >= 1. If either is missing or empty the index's generation metadata is considered invalid and parsing fails. Generation metadata identifies which snapshot of the index this is.

Solutions

  1. Set meta.generation to a non-empty identifier in the index generator
  2. Set meta.publishedAt to a positive Unix timestamp
  3. Re-fetch the index from the canonical bazaar endpoint

Example fix

// before
{"meta":{"schema":2,"generation":"","publishedAt":0},"packages":{}}
// after
{"meta":{"schema":2,"generation":"2026-09-18T00:00:00Z","publishedAt":1789000000},"packages":{}}
Defensive patterns

Strategy: validation

Validate before calling

if (!idx.meta.generation?.trim() || !(idx.meta.publishedAt >= 1)) throw new Error("index meta requires non-empty generation and publishedAt >= 1")

Prevention

When it happens

Trigger: fetchBazaarIndexPath gets an index where meta.generation is "" or whitespace-only, or meta.publishedAt is 0/absent, while meta.schema >= 2.

Common situations: An index generator that writes meta.schema but forgets generation/publishedAt; a partially migrated server; hand-crafted fixtures missing required meta fields.

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


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/0f87b962c9920b14. Report an issue: GitHub.

Appendix: source

Thrown at kernel/bazaar/index.go:219

	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 {
					return nil, fmt.Errorf("invalid bazaar index package: %s", packageName)
				}
				if nil != pkg.Rating {

View on GitHub (pinned to 9f775e8a12)