siyuan-note/siyuan · error
marketplace package archive is empty
Error message
marketplace package archive is empty
What it means
The uploaded marketplace package (.zip) opened successfully but contains zero member entries. Thrown by extractLocalPackageArchive (kernel/bazaar/local.go:96-98) right after zip.OpenReader succeeds, as a sanity guard before iterating reader.File. It prevents the rest of the pipeline from operating on a structurally valid but content-less archive.
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 251596fc0d)
Solutions
- Inspect the archive with `unzip -l <path>` (or `go tool` / `archive/zip`) and confirm it lists files
- Re-create the archive so it actually contains the package payload (manifest + assets)
- If generating the zip in CI, verify the file-glob step matched files before zipping
Example fix
// before: zip created from empty glob zip -r pkg.zip ./dist/* # ./dist/* matched nothing // after: ensure files exist before zipping zip -r pkg.zip plugin.json README.md ./dist
Defensive patterns
Strategy: validation
Validate before calling
// Run before calling bazaar.ExtractLocalPackage
func assertArchiveNonEmpty(path string) error {
r, err := zip.OpenReader(path)
if err != nil { return fmt.Errorf("not a valid zip: %w", err) }
defer r.Close()
if len(r.File) == 0 { return errors.New("archive has no entries") }
return nil
} Try / catch
pkgType, pkg, src, cleanup, err := bazaar.ExtractLocalPackage(archivePath)
if err != nil {
cleanup()
// err already carries the specific message; surface to the upload caller
return err
}
defer cleanup() Prevention
- Validate uploaded archives with archive/zip before forwarding to ExtractLocalPackage
- In CI packaging steps, assert `unzip -l pkg.zip | wc -l` > 0 before publishing
- Reject zero-byte or empty-zip uploads at the HTTP handler before they reach the kernel
When it happens
Trigger: Calling bazaar.ExtractLocalPackage (or model.InstallLocalBazaarPackage) with archivePath pointing to a valid zip file whose central directory lists no files. The HTTP/API entry point is the local-package install endpoint which forwards the uploaded archive path here.
Common situations: The user re-zipped an already-extracted folder but glob matched nothing, a build step emitted an empty archive, or a partially downloaded/corrupt archive happened to parse as a valid empty zip.
Related errors
- invalid marketplace package archive
- marketplace package manifest must be at the archive root or
- invalid marketplace package type
- marketplace package manifest not found or invalid
- multiple marketplace package manifests found
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/2918669f5a45b6e3.
Report an issue: GitHub.