{"record":{"id":"b2cee5cbc9e8b725","repo":"siyuan-note/siyuan","slug":"invalid-layer-source-w","errorCode":null,"errorMessage":"invalid layer source: %w","messagePattern":"invalid layer source: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":465,"sourceCode":"\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, manifest.Style, \"style\"); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid style: %w\", err)\n\t\t}\n\t\tret.Style = bootAppearanceAssetURL(pkg.Name, appearanceID, manifest.Style)\n\t}\n\n\tlayerIDs := map[string]bool{}\n\tfor _, layer := range manifest.Layers {\n\t\tif layer == nil || !isValidBootAppearanceID(layer.ID) || layerIDs[layer.ID] {\n\t\t\terr = errors.New(\"invalid or duplicate layer ID\")\n\t\t\treturn nil, err\n\t\t}\n\t\tlayerIDs[layer.ID] = true\n\t\tif layer.Type != \"image\" && layer.Type != \"video\" {\n\t\t\terr = fmt.Errorf(\"unsupported layer type [%s]\", layer.Type)\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Src, layer.Type); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid layer source: %w\", err)\n\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) {","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L447-L483","documentation":"Every layer's src is validated with validateBootAppearanceResource, which enforces that the source resolves inside the appearance directory, exists, has the right extension for the declared layer type, and respects size limits. Failures are wrapped as \"invalid layer source\".","triggerScenarios":"manifest.json layer has a src that is missing on disk, points outside the appearance directory (traversal, symlink, absolute path), has an extension mismatched with layer.type (e.g. .png on a video layer), or exceeds the resource size limit.","commonSituations":"Media file not included in the plugin package; renamed asset without updating the manifest; absolute local path left from development; oversized video exceeding the kernel's size cap; case-mismatched file name on case-sensitive filesystems.","solutions":["Verify the src file exists in the appearance directory and the name matches exactly (case included).","Use a relative path inside the appearance directory; remove any \"..\" or absolute segments and symlinks.","Match the file extension to the layer type (image types for image layers, video extensions for video layers).","Compress or trim the media so it fits within the kernel's resource size limit."],"exampleFix":"// before: manifest.json\n{\"id\":\"bg\",\"type\":\"image\",\"src\":\"/Users/me/Pictures/bg.png\"}\n// after\n{\"id\":\"bg\",\"type\":\"image\",\"src\":\"assets/bg.png\"}  // packaged with the appearance","handlingStrategy":"validation","validationCode":"for (const l of manifest.layers) {\n  const p = path.resolve(appearanceDir, l.src);\n  if (!p.startsWith(path.resolve(appearanceDir) + path.sep) || !fs.existsSync(p)) throw new Error('bad layer src: ' + l.src);\n}","typeGuard":null,"tryCatchPattern":"try { loadAppearance(id); } catch (e) { if (/invalid layer source/.test(String(e))) { /* fix src existence, containment, extension, or size */ } }","preventionTips":["Ship every referenced asset inside the appearance folder","Keep src relative and extension-consistent with the layer type","Watch file-size limits; compress media before packaging"],"tags":["boot-appearance","layers","resource-validation","missing-file"],"backgroundTag":"file-not-found","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"}