siyuan-note/siyuan · error
invalid layer position
Error message
invalid layer position [%s]
What it means
loadBootAppearance validates each layer of a boot appearance package. Every layer must declare a `position` that is one of a fixed set accepted by isValidBootAppearancePosition (empty defaults to "center"). If a manifest layer's position string is non-empty but not a recognized value, package loading aborts with this error naming the offending value.
Solutions
- Open the package's manifest.json and change the layer's `position` to a valid value accepted by isValidBootAppearancePosition (e.g. "center"), or delete the field to use the "center" default
- Check for typos, surrounding whitespace, and letter case — position matching is exact
- If the position value comes from a newer package format, upgrade the SiYuan kernel to a version that supports it
Example fix
// manifest.json before
{"layers": [{"id": "logo", "type": "image", "src": "logo.png", "position": "top-left"}]}
// after
{"layers": [{"id": "logo", "type": "image", "src": "logo.png", "position": "center"}]} Defensive patterns
Strategy: validation
Validate before calling
const VALID_POSITIONS = new Set(["center"]); // extend per isValidBootAppearancePosition
function validLayerPosition(p) {
return typeof p !== "string" || p === "" || VALID_POSITIONS.has(p);
} Type guard
function isKnownPosition(p) { return p === "" || p === "center"; } Try / catch
try {
const list = await fetchPost("/api/.../getBootAppearances");
} catch (e) {
if (String(e).includes("invalid layer position")) {
// point user to the manifest layer position named in the brackets
}
} Prevention
- Use only documented position values in manifest layers
- Omit `position` entirely to get the "center" default
- Keep letter case and spelling exact — no trimming or normalization is applied
When it happens
Trigger: Calling GetBootAppearances or getBootAppearanceByID while loading a boot appearance package whose manifest.json contains a layer with `position` set to an unknown string (e.g. "top-left", "bottom", a typo like "centerr", or extra whitespace/case variants like "Center").
Common situations: Hand-editing a boot appearance manifest and mistyping the position; copying a position value from another plugin system with a different vocabulary; a package built for a newer/older format version that added positions this kernel version does not know.
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
- displayName.default is required
- invalid display name
- unsupported schema version or mismatched appearance ID
- 199
- invalid appearance ID
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/30e5fedd93f22023.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/boot_appearance.go:492
}
} else if layer.Poster != "" {
err = errors.New("image layer cannot declare a poster")
return nil, err
}
fit := layer.Fit
if fit == "" {
fit = "cover"
}
if !isValidBootAppearanceFit(fit) {
err = fmt.Errorf("invalid layer fit [%s]", fit)
return nil, err
}
position := layer.Position
if position == "" {
position = "center"
}
if !isValidBootAppearancePosition(position) {
err = fmt.Errorf("invalid layer position [%s]", position)
return nil, err
}
item := &BootAppearanceLayer{
ID: layer.ID,
Type: layer.Type,
Src: bootAppearanceAssetURL(pkg.Name, appearanceID, layer.Src),
Fit: fit,
Position: position,
}
if layer.Poster != "" {
item.Poster = bootAppearanceAssetURL(pkg.Name, appearanceID, layer.Poster)
}
ret.Layers = append(ret.Layers, item)
}
return
}
func validateBootAppearancePackage(pluginDir, appearanceDir string) error {View on GitHub (pinned to 9f775e8a12)