siyuan-note/siyuan · error

boot appearance path is too deep or long

Error message

boot appearance path is too deep or long

What it means

During the same package walk as the entry-count limit, each entry's relative path is checked against maxBootAppearancePathLength (character count) and maxBootAppearancePathDepth (slash-separated segment count). Exceeding either aborts with this error, guarding against filesystem limits and path-abuse archives.

Solutions

  1. Flatten or rename the offending paths so they are shorter and shallower, then repackage
  2. Move deeply nested assets up to a shallow directory such as assets/
  3. Shorten long hashed or descriptive filenames to concise names

Example fix

// before
assets/themes/dark/2026/09/backgrounds/generated/final-banner-abc123def456.png
// after
assets/banner.png
Defensive patterns

Strategy: validation

Validate before calling

function pathsWithinLimit(files, maxLen, maxDepth) {
  return files.every(p => p.length <= maxLen && p.split("/").length <= maxDepth);
}

Try / catch

try {
  await installBootAppearance(zipPath);
} catch (e) {
  if (String(e).includes("too deep or long")) {
    // flatten paths and repackage
  }
}

Prevention

When it happens

Trigger: A boot appearance package containing a file or directory whose path is longer than maxBootAppearancePathLength characters or nested deeper than maxBootAppearancePathDepth segments (e.g. assets/a/b/c/d/e/.../img.png).

Common situations: Packaging export artifacts with long generated hashes in filenames; deeply nested source trees archived as-is; archives built on filesystems permitting longer paths than the target platform.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/boot_appearance.go:535

	}
	var totalSize int64
	entryCount := 0
	err = filepath.WalkDir(appearanceDir, func(filePath string, entry os.DirEntry, walkErr error) error {
		if walkErr != nil {
			return walkErr
		}
		relativePath, relativeErr := filepath.Rel(appearanceDir, filePath)
		if relativeErr != nil {
			return ErrBootAppearanceAssetForbidden
		}
		if relativePath != "." {
			entryCount++
			if entryCount > maxBootAppearanceEntries {
				return errors.New("too many boot appearance entries")
			}
			if len(relativePath) > maxBootAppearancePathLength ||
				len(strings.Split(filepath.ToSlash(relativePath), "/")) > maxBootAppearancePathDepth {
				return errors.New("boot appearance path is too deep or long")
			}
		}
		if entry.Type()&os.ModeSymlink != 0 {
			return ErrBootAppearanceAssetForbidden
		}
		if entry.IsDir() {
			return nil
		}
		info, infoErr := entry.Info()
		if infoErr != nil || !info.Mode().IsRegular() {
			return ErrBootAppearanceAssetForbidden
		}
		totalSize += info.Size()
		if totalSize > maxBootAppearanceTotalSize {
			return errors.New("boot appearance package is too large")
		}
		return nil
	})

View on GitHub (pinned to 9f775e8a12)