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

Each zip entry's declared uncompressed size (UncompressedSize64) is checked against maxLocalPackageFileSize (256 MiB). A single entry declaring more than this is rejected before extraction, since legitimately no marketplace package needs such a file.

Solutions

  1. Remove oversized assets from the package or host them externally (CDN/asset store)
  2. Compress or split large data files
  3. Check entry sizes with unzip -l before uploading

Example fix

// before: package includes assets/model.bin (400 MB)
// after: remove model.bin; download it at runtime or shrink below 256 MiB
Defensive patterns

Strategy: validation

Validate before calling

const sizes = execSync(`unzip -l ${zipPath}`).toString().split("\n");
const oversized = sizes.some(l => parseInt(l.trim().split(/\s+/)[0], 10) > 256 * 1024 * 1024);
if (oversized) throw new Error("an entry exceeds the 256 MiB per-file limit");

Try / catch

try { await installLocalPackage(zipPath); } catch (e) { if (String(e).includes("file that is too large")) { /* remove or shrink the big entry */ } }

Prevention

When it happens

Trigger: Calling ExtractLocalPackage with a zip where one entry's header UncompressedSize64 exceeds 256 MiB.

Common situations: Bundling a huge video/model/database dump inside the package; a malicious zip with a lying header is caught here before extraction; accidentally zipping a large build artifact.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: 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 9f775e8a12)