{"record":{"id":"9c665ca659bae381","repo":"siyuan-note/siyuan","slug":"invalid-layer-fit-s","errorCode":null,"errorMessage":"invalid layer fit [%s]","messagePattern":"invalid layer fit \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":484,"sourceCode":"\t\t}\n\t\tif layer.Type == \"video\" {\n\t\t\tif layer.Poster == \"\" {\n\t\t\t\terr = errors.New(\"video poster is required\")\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Poster, \"image\"); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid video poster: %w\", err)\n\t\t\t}\n\t\t} else if layer.Poster != \"\" {\n\t\t\terr = errors.New(\"image layer cannot declare a poster\")\n\t\t\treturn nil, err\n\t\t}\n\t\tfit := layer.Fit\n\t\tif fit == \"\" {\n\t\t\tfit = \"cover\"\n\t\t}\n\t\tif !isValidBootAppearanceFit(fit) {\n\t\t\terr = fmt.Errorf(\"invalid layer fit [%s]\", fit)\n\t\t\treturn nil, err\n\t\t}\n\t\tposition := layer.Position\n\t\tif position == \"\" {\n\t\t\tposition = \"center\"\n\t\t}\n\t\tif !isValidBootAppearancePosition(position) {\n\t\t\terr = fmt.Errorf(\"invalid layer position [%s]\", position)\n\t\t\treturn nil, err\n\t\t}\n\t\titem := &BootAppearanceLayer{\n\t\t\tID:       layer.ID,\n\t\t\tType:     layer.Type,\n\t\t\tSrc:      bootAppearanceAssetURL(pkg.Name, appearanceID, layer.Src),\n\t\t\tFit:      fit,\n\t\t\tPosition: position,\n\t\t}\n\t\tif layer.Poster != \"\" {","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L466-L502","documentation":"Each layer's fit describes how the media fills the boot screen (defaulting to \"cover\" when empty). If the resolved fit is not one of the values accepted by isValidBootAppearanceFit, the kernel rejects the manifest with this error.","triggerScenarios":"A manifest.json layer sets \"fit\" to a value outside the accepted set (e.g. \"fill-stretch\", \"100%\", \"Cover\" with a capital letter, or a CSS object-fit-like value the kernel does not whitelist).","commonSituations":"Author copying CSS object-fit values that the kernel does not support; wrong casing; inventing a fit mode hoping it maps to CSS; manifest edited by hand with a typo such as \"covert\".","solutions":["Set layer \"fit\" to one of the kernel-accepted values (see isValidBootAppearanceFit in kernel/model/boot_appearance.go, e.g. cover/contain/fill).","Remove the \"fit\" field entirely to get the default \"cover\" behavior.","Fix casing/typos so the value matches the whitelist exactly (lowercase)."],"exampleFix":"// before: manifest.json\n{\"id\":\"bg\",\"type\":\"image\",\"src\":\"bg.png\",\"fit\":\"Cover\"}\n// after\n{\"id\":\"bg\",\"type\":\"image\",\"src\":\"bg.png\",\"fit\":\"cover\"}","handlingStrategy":"validation","validationCode":"const FITS = ['cover', 'contain', 'fill']; // mirror isValidBootAppearanceFit\nfor (const l of manifest.layers) {\n  const fit = l.fit || 'cover';\n  if (!FITS.includes(fit)) throw new Error(`invalid layer fit: ${fit}`);\n}","typeGuard":"function hasValidFit(l) { const f = l.fit || 'cover'; return ['cover', 'contain', 'fill'].includes(f); }","tryCatchPattern":"try { loadAppearance(id); } catch (e) { if (/invalid layer fit/.test(String(e))) { /* correct or remove the fit field */ } }","preventionTips":["Use only whitelisted lowercase fit values","Omit fit when the default 'cover' is fine","Check isValidBootAppearanceFit when the kernel adds new modes"],"tags":["boot-appearance","layers","enum","fit"],"backgroundTag":"invalid-enum-value","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}