siyuan-note/siyuan · error

marketplace package archive is empty

Error message

marketplace package archive is empty

What it means

Error from extractLocalPackageArchive when a locally supplied marketplace package zip opens successfully but contains zero file entries — an empty archive cannot hold a valid package.json manifest, so installation is aborted.

Solutions

  1. Rebuild the zip making sure files are actually added
  2. Verify with unzip -l that the archive lists entries
  3. Fix the build/packaging script so compression happens after files are produced

Example fix

// before: zip -r plugin.zip (run before build output exists -> empty)
// after: run build first, then zip -r plugin.zip dist/
Defensive patterns

Strategy: validation

Validate before calling

const entries = execSync(`unzip -l ${zipPath}`).toString().trim().split("\n").length;
if (entries < 4) throw new Error("archive appears empty"); // header/footer lines are not entries

Try / catch

try { await installLocalPackage(zipPath); } catch (e) { if (String(e).includes("archive is empty")) { /* rebuild the zip */ } }

Prevention

When it happens

Trigger: Calling ExtractLocalPackage on a structurally valid zip that contains no files at all.

Common situations: Zip tool created an empty archive (nothing selected); build script zipped before copying files; a previous partial cleanup deleted all entries before compression.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at kernel/bazaar/local.go:97

	}

	pkg, err = ParsePackageJSON(manifestPath)
	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")
		}
	}

View on GitHub (pinned to 9f775e8a12)