siyuan-note/siyuan · error

marketplace package contains too many files

Error message

marketplace package contains too many files

What it means

extractLocalPackageArchive enforces maxLocalPackageFileCount (10000 entries). Archives declaring more entries than this are rejected before any bytes are extracted, protecting the kernel from decompression bombs made of many small files.

Solutions

  1. Exclude node_modules, .git, and caches from the zip
  2. Prune the package to only runtime files required by the manifest
  3. Add exclusion flags when zipping (e.g. zip -r plugin.zip . -x 'node_modules/*' '.git/*')

Example fix

// before: zip -r plugin.zip .
// after: zip -r plugin.zip . -x "node_modules/*" -x ".git/*"
Defensive patterns

Strategy: validation

Validate before calling

const count = Number(execSync(`unzip -l ${zipPath} | tail -1`).toString().match(/(\d+) files?/)?.[1] ?? 0);
if (count > 10000) throw new Error("too many entries: " + count);

Try / catch

try { await installLocalPackage(zipPath); } catch (e) { if (String(e).includes("too many files")) { /* add exclusions and rezip */ } }

Prevention

When it happens

Trigger: Calling ExtractLocalPackage with a zip containing more than 10,000 entries (files + directories counted from reader.File).

Common situations: Packaging node_modules or a build cache into the plugin zip; including a vendored dependency tree; accidental inclusion of .git directory with many objects.

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/375d6a2a39a7abcf. Report an issue: GitHub.

Appendix: source

Thrown at kernel/bazaar/local.go:100

	if err != nil || pkg == nil {
		err = errors.New("invalid marketplace package manifest")
		cleanup()
	}
	return
}

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

View on GitHub (pinned to 9f775e8a12)