{"record":{"id":"b47193b8d7ae18cb","repo":"siyuan-note/siyuan","slug":"invalid-marketplace-package-archive","errorCode":null,"errorMessage":"invalid marketplace package archive","messagePattern":"invalid marketplace package archive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/local.go","lineNumber":92,"sourceCode":"\t}\n\tif manifestPath == \"\" {\n\t\terr = errors.New(\"marketplace package manifest not found\")\n\t\tcleanup()\n\t\treturn\n\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}","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/bazaar/local.go#L74-L110","documentation":"Returned by extractLocalPackageArchive (kernel/bazaar/local.go:90-92) when zip.OpenReader fails on the provided archive path. This means Go's archive/zip package could not open the file as a valid zip archive at all — the file may not be a zip, may be truncated, or uses an unsupported compression method. This check runs before any content/size validation.","triggerScenarios":"Uploading a local marketplace package file that is not a valid zip archive — a tar.gz, a renamed non-zip file, a truncated download, or a corrupt archive.","commonSituations":"User selected a .tar.gz or .7z file instead of .zip; the file was renamed to .zip but is not actually a zip; the download/upload was interrupted leaving a partial file; the zip uses Zip64 or an encryption method that Go's reader rejects.","solutions":["Re-export or re-download the package as a standard .zip file","Verify the file is a valid zip by opening it in an archive manager before uploading","Ensure the file is not truncated — check the file size matches the source","Avoid encrypted or non-standard zip variants; use standard deflate/store compression"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func isValidZipArchive(archivePath string) error {\n    r, err := zip.OpenReader(archivePath)\n    if err != nil {\n        return fmt.Errorf(\"not a valid zip archive: %w\", err)\n    }\n    r.Close()\n    return nil\n}\n// Call before ExtractLocalPackage","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the file is a standard .zip before uploading — not .tar.gz, .7z, or .rar","Check the file is not truncated by comparing its size to the source","Use standard zip compression (deflate or store) — avoid encrypted or Zip64 variants if possible","Open the file in an archive manager to confirm integrity before uploading"],"tags":["bazaar","marketplace","local-package","zip","archive","validation","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}