siyuan-note/siyuan · error

marketplace package contains a file that is too large

Error message

marketplace package contains a file that is too large

What it means

A single zip entry declares an UncompressedSize64 greater than maxLocalPackageFileSize (256 MiB). Thrown in the first pass of extractLocalPackageArchive (kernel/bazaar/local.go:105-106) using the header's declared size, before any bytes are actually decompressed. It is a per-file cap independent of the overall archive size.

Source

Thrown at kernel/bazaar/local.go:106

func extractLocalPackageArchive(archivePath, destination string) error {
	reader, err := zip.OpenReader(archivePath)
	if err != nil {
		return errors.New("invalid marketplace package archive")
	}
	defer reader.Close()

	if len(reader.File) == 0 {
		return errors.New("marketplace package archive is empty")
	}
	if len(reader.File) > maxLocalPackageFileCount {
		return errors.New("marketplace package contains too many files")
	}

	var declaredTotal uint64
	for _, item := range reader.File {
		if item.UncompressedSize64 > maxLocalPackageFileSize {
			return errors.New("marketplace package contains a file that is too large")
		}
		if ^uint64(0)-declaredTotal < item.UncompressedSize64 {
			return errors.New("marketplace package is too large")
		}
		declaredTotal += item.UncompressedSize64
		if declaredTotal > maxLocalPackageExtractSize {
			return errors.New("marketplace package is too large")
		}
	}

	if err = os.MkdirAll(destination, 0755); err != nil {
		return err
	}
	var extractedTotal uint64
	for _, item := range reader.File {
		if err = extractLocalPackageItem(item, destination, &extractedTotal); err != nil {
			return err
		}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Identify the oversized entry with `unzip -lv <path>` and remove or shrink it
  2. Compress or downsample large media before packaging
  3. Split oversized assets out of the marketplace package and load them at runtime instead

Example fix

// before: bundling a 300MB video into the zip
zip -r pkg.zip plugin.json intro.mp4

// after: host the asset externally and reference its URL
zip -r pkg.zip plugin.json
Defensive patterns

Strategy: validation

Validate before calling

func assertNoOversizedFile(path string) error {
    r, err := zip.OpenReader(path)
    if err != nil { return err }
    defer r.Close()
    for _, f := range r.File {
        if f.UncompressedSize64 > 256<<20 {
            return fmt.Errorf("entry %q declares %d bytes (>256MiB)", f.Name, f.UncompressedSize64)
        }
    }
    return nil
}

Try / catch

// ExtractLocalPackage already enforces this; map the returned error to a user-facing message
if err != nil { return fmt.Errorf("package rejected: %w", err) }

Prevention

When it happens

Trigger: ExtractLocalPackage processes an archive where at least one entry's zip header reports an uncompressed size over 256 MiB. Common with bundled videos, model files, large datasets, or prebuilt binaries.

Common situations: A plugin bundles a large binary asset (ML model, video, image atlas); a theme ships uncompressed high-res artwork; a malicious archive spoofs a huge declared size.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/02a0f3e3ed567b73. Report an issue: GitHub.