siyuan-note/siyuan · error

too many layers

Error message

too many layers: %d

What it means

The boot appearance manifest declares more layers (background images/videos) than the kernel allows (maxBootAppearanceLayers). The kernel caps layer count to keep boot rendering cheap and prevent resource abuse, and refuses to load the appearance outright.

Solutions

  1. Reduce the "layers" array in manifest.json to at most maxBootAppearanceLayers entries (merge visual effects into fewer image/video layers).
  2. Split the design into multiple boot appearances instead of one oversized one.
  3. Check the current cap (maxBootAppearanceLayers in kernel/model/boot_appearance.go) and design within it.

Example fix

// before: manifest.json layers
"layers": [ {"id":"l1"}, {"id":"l2"}, {"id":"l3"}, {"id":"l4"}, {"id":"l5"}, ... ]
// after (cap is e.g. 4)
"layers": [ {"id":"l1"}, {"id":"l2"}, {"id":"l3"}, {"id":"l4"} ]
Defensive patterns

Strategy: validation

Validate before calling

const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
if (Array.isArray(manifest.layers) && manifest.layers.length > MAX_BOOT_APPEARANCE_LAYERS) throw new Error(`too many layers: ${manifest.layers.length}`);

Try / catch

try { loadAppearance(id); } catch (e) { if (/too many layers/.test(String(e))) { trimLayers(manifest, MAX_BOOT_APPEARANCE_LAYERS); } }

Prevention

When it happens

Trigger: GetBootAppearances or getBootAppearanceByID loads a manifest.json whose "layers" array length exceeds maxBootAppearanceLayers.

Common situations: A plugin author stacks many decorative animation layers in one appearance; an appearance was extended layer-by-layer over time past the cap; a generated manifest from a tool emits unbounded layers.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/boot_appearance.go:414

		return
	}
	if manifest.SchemaVersion != bootAppearanceSchemaVersion || manifest.ID != appearanceID {
		err = errors.New("unsupported schema version or mismatched appearance ID")
		return
	}
	if err = validateBootAppearanceDisplayName(manifest.DisplayName); err != nil {
		return
	}
	frontends, frontendErr := normalizeBootAppearanceFrontends(manifest.Frontends, pkg.Frontends)
	if frontendErr != nil {
		err = frontendErr
		return
	}
	if err = validateOptionalBootAppearanceColor(manifest.BackgroundColor); err != nil {
		return
	}
	if len(manifest.Layers) > maxBootAppearanceLayers {
		err = fmt.Errorf("too many layers: %d", len(manifest.Layers))
		return
	}

	ret = &BootAppearance{
		Enabled:         true,
		Provider:        pkg.Name,
		Appearance:      appearanceID,
		DisplayName:     bazaar.GetPreferredLocaleString(bazaar.LocaleStrings(manifest.DisplayName), appearanceID),
		Frontends:       frontends,
		BackgroundColor: manifest.BackgroundColor,
		OfficialUI: &BootAppearanceOfficialUI{
			ShowLogo:    true,
			ShowDetails: true,
		},
	}
	if manifest.OfficialUI.ShowLogo != nil {
		ret.OfficialUI.ShowLogo = *manifest.OfficialUI.ShowLogo
	}

View on GitHub (pinned to 9f775e8a12)