siyuan-note/siyuan · error

unsupported layer type

Error message

unsupported layer type [%s]

What it means

Boot appearance layers only support the types "image" and "video". Any other layer.type value in the manifest is rejected with this error so the kernel never has to render an unknown media kind at boot.

Solutions

  1. Set layer "type" to exactly "image" or "video" (lowercase).
  2. Convert unsupported media (e.g. GIF) into a supported image/video format before referencing it.
  3. If you need richer layers, implement the effect inside the style/asset itself rather than as a separate layer type.
  4. Check the installed kernel's supported set in loadBootAppearance before adding new types.

Example fix

// before: manifest.json
{"id":"anim","type":"lottie","src":"anim.json"}
// after
{"id":"anim","type":"video","src":"anim.mp4","poster":"anim.png"}
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = ['image', 'video'];
(manifest.layers || []).forEach(l => { if (!ALLOWED.includes(l.type)) throw new Error(`unsupported layer type: ${l.type}`); });

Type guard

function isSupportedLayer(l) { return l.type === 'image' || l.type === 'video'; }

Try / catch

try { loadAppearance(id); } catch (e) { if (/unsupported layer type/.test(String(e))) { /* convert the layer to image or video */ } }

Prevention

When it happens

Trigger: A manifest.json layer entry has "type" set to something other than image or video (e.g. "text", "gif", "webm", "lottie", or a capitalized "Image").

Common situations: Author assuming GIF or Lottie animations are supported as a layer type; a typo or wrong-case type value; copying a layer schema from another plugin system with richer layer kinds; manifest authored for a newer spec that introduced new types not supported by the installed kernel.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/boot_appearance.go:461

	ret.OfficialUI.ProgressColor = manifest.OfficialUI.ProgressColor
	ret.OfficialUI.TrackColor = manifest.OfficialUI.TrackColor

	if manifest.Style != "" {
		if _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, manifest.Style, "style"); err != nil {
			return nil, fmt.Errorf("invalid style: %w", err)
		}
		ret.Style = bootAppearanceAssetURL(pkg.Name, appearanceID, manifest.Style)
	}

	layerIDs := map[string]bool{}
	for _, layer := range manifest.Layers {
		if layer == nil || !isValidBootAppearanceID(layer.ID) || layerIDs[layer.ID] {
			err = errors.New("invalid or duplicate layer ID")
			return nil, err
		}
		layerIDs[layer.ID] = true
		if layer.Type != "image" && layer.Type != "video" {
			err = fmt.Errorf("unsupported layer type [%s]", layer.Type)
			return nil, err
		}
		if _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Src, layer.Type); err != nil {
			return nil, fmt.Errorf("invalid layer source: %w", err)
		}
		if layer.Type == "video" {
			if layer.Poster == "" {
				err = errors.New("video poster is required")
				return nil, err
			}
			if _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Poster, "image"); err != nil {
				return nil, fmt.Errorf("invalid video poster: %w", err)
			}
		} else if layer.Poster != "" {
			err = errors.New("image layer cannot declare a poster")
			return nil, err
		}
		fit := layer.Fit

View on GitHub (pinned to 9f775e8a12)