{"record":{"id":"2fec2f0a624aeb7e","repo":"siyuan-note/siyuan","slug":"too-many-boot-appearance-entries","errorCode":null,"errorMessage":"too many boot appearance entries","messagePattern":"too many boot appearance entries","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":531,"sourceCode":"\t}\n\tinfo, err := os.Stat(appearanceDir)\n\tif err != nil || !info.IsDir() {\n\t\treturn ErrBootAppearanceNotFound\n\t}\n\tvar totalSize int64\n\tentryCount := 0\n\terr = filepath.WalkDir(appearanceDir, func(filePath string, entry os.DirEntry, walkErr error) error {\n\t\tif walkErr != nil {\n\t\t\treturn walkErr\n\t\t}\n\t\trelativePath, relativeErr := filepath.Rel(appearanceDir, filePath)\n\t\tif relativeErr != nil {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\tif relativePath != \".\" {\n\t\t\tentryCount++\n\t\t\tif entryCount > maxBootAppearanceEntries {\n\t\t\t\treturn errors.New(\"too many boot appearance entries\")\n\t\t\t}\n\t\t\tif len(relativePath) > maxBootAppearancePathLength ||\n\t\t\t\tlen(strings.Split(filepath.ToSlash(relativePath), \"/\")) > maxBootAppearancePathDepth {\n\t\t\t\treturn errors.New(\"boot appearance path is too deep or long\")\n\t\t\t}\n\t\t}\n\t\tif entry.Type()&os.ModeSymlink != 0 {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\tif entry.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tinfo, infoErr := entry.Info()\n\t\tif infoErr != nil || !info.Mode().IsRegular() {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\ttotalSize += info.Size()\n\t\tif totalSize > maxBootAppearanceTotalSize {","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L513-L549","documentation":"While walking the extracted contents of a boot appearance package, each non-\".\" entry increments a counter. When the count exceeds maxBootAppearanceEntries, the walker aborts with this error. This is a resource-safety limit that prevents a malicious or runaway package from exploding the number of files unpacked on disk.","triggerScenarios":"Installing or loading a boot appearance package whose archive contains more entries than maxBootAppearanceEntries; archives that unpack many files or nested directories, including zip bombs or accidentally included build artifacts/node_modules.","commonSituations":"Packaging a theme with thousands of unused asset files; archiving a directory that includes caches, VCS folders, or dependency trees; a deliberately crafted archive designed to exhaust disk.","solutions":["Remove unnecessary files from the package so the total entry count stays under the maxBootAppearanceEntries limit and repackage","Exclude build artifacts, caches, and dependency directories (node_modules, .git) from the archive","If you genuinely need more entries, split the appearance into multiple packages or request a limit change upstream"],"exampleFix":"// before: zip -r appearance.zip . (includes .git, node_modules)\n// after\ncat > package.json.ignore <<'EOF'\n.git\nnode_modules\n*.log\nEOF\nzip -r appearance.zip . -x '.git/*' 'node_modules/*'","handlingStrategy":"validation","validationCode":"function countEntries(files, max) {\n  return files.filter(f => f !== \".\").length <= max;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installBootAppearance(zipPath);\n} catch (e) {\n  if (String(e).includes(\"too many boot appearance entries\")) {\n    // repackage with fewer files\n  }\n}","preventionTips":["Exclude .git, node_modules, caches and build output when archiving","Count archive entries with `unzip -l | wc -l` before shipping","Keep boot appearance packages small and focused"],"tags":["boot-appearance","package-limits","archive"],"backgroundTag":"payload-too-large","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"}