{"record":{"id":"2918669f5a45b6e3","repo":"siyuan-note/siyuan","slug":"marketplace-package-archive-is-empty","errorCode":null,"errorMessage":"marketplace package archive is empty","messagePattern":"marketplace package archive is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/local.go","lineNumber":97,"sourceCode":"\t}\n\n\tpkg, err = ParsePackageJSON(manifestPath)\n\tif err != nil || pkg == nil {\n\t\terr = errors.New(\"invalid marketplace package manifest\")\n\t\tcleanup()\n\t}\n\treturn\n}\n\nfunc extractLocalPackageArchive(archivePath, destination string) error {\n\treader, err := zip.OpenReader(archivePath)\n\tif err != nil {\n\t\treturn errors.New(\"invalid marketplace package archive\")\n\t}\n\tdefer reader.Close()\n\n\tif len(reader.File) == 0 {\n\t\treturn errors.New(\"marketplace package archive is empty\")\n\t}\n\tif len(reader.File) > maxLocalPackageFileCount {\n\t\treturn errors.New(\"marketplace package contains too many files\")\n\t}\n\n\tvar declaredTotal uint64\n\tfor _, item := range reader.File {\n\t\tif item.UncompressedSize64 > maxLocalPackageFileSize {\n\t\t\treturn errors.New(\"marketplace package contains a file that is too large\")\n\t\t}\n\t\tif ^uint64(0)-declaredTotal < item.UncompressedSize64 {\n\t\t\treturn errors.New(\"marketplace package is too large\")\n\t\t}\n\t\tdeclaredTotal += item.UncompressedSize64\n\t\tif declaredTotal > maxLocalPackageExtractSize {\n\t\t\treturn errors.New(\"marketplace package is too large\")\n\t\t}\n\t}","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/bazaar/local.go#L79-L115","documentation":"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.","triggerScenarios":"Calling ExtractLocalPackage on a structurally valid zip that contains no files at all.","commonSituations":"Zip tool created an empty archive (nothing selected); build script zipped before copying files; a previous partial cleanup deleted all entries before compression.","solutions":["Rebuild the zip making sure files are actually added","Verify with unzip -l that the archive lists entries","Fix the build/packaging script so compression happens after files are produced"],"exampleFix":"// before: zip -r plugin.zip (run before build output exists -> empty)\n// after: run build first, then zip -r plugin.zip dist/","handlingStrategy":"validation","validationCode":"const entries = execSync(`unzip -l ${zipPath}`).toString().trim().split(\"\\n\").length;\nif (entries < 4) throw new Error(\"archive appears empty\"); // header/footer lines are not entries","typeGuard":null,"tryCatchPattern":"try { await installLocalPackage(zipPath); } catch (e) { if (String(e).includes(\"archive is empty\")) { /* rebuild the zip */ } }","preventionTips":["Confirm zip contains files (unzip -l)","Build artifacts before packaging","Re-zip after any cleanup step"],"tags":["bazaar","zip","archive","empty"],"backgroundTag":"empty-result-set","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}