{"record":{"id":"9ffd13dd706e04f5","repo":"siyuan-note/siyuan","slug":"multiple-marketplace-package-manifests-found","errorCode":null,"errorMessage":"multiple marketplace package manifests found","messagePattern":"multiple marketplace package manifests found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/local.go","lineNumber":67,"sourceCode":"\ttempPath := filepath.Join(util.TempDir, \"bazaar\", \"local\", gulu.Rand.String(7))\n\tcleanup = func() { _ = os.RemoveAll(tempPath) }\n\tif err = extractLocalPackageArchive(archivePath, tempPath); err != nil {\n\t\tcleanup()\n\t\treturn\n\t}\n\n\tpackagePath, err = localPackageRoot(tempPath)\n\tif err != nil {\n\t\tcleanup()\n\t\treturn\n\t}\n\n\tvar manifestPath string\n\tfor manifestName, packageType := range localPackageManifests {\n\t\tcandidate := filepath.Join(packagePath, manifestName)\n\t\tif info, statErr := os.Stat(candidate); statErr == nil && info.Mode().IsRegular() {\n\t\t\tif manifestPath != \"\" {\n\t\t\t\terr = errors.New(\"multiple marketplace package manifests found\")\n\t\t\t\tcleanup()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpkgType = packageType\n\t\t\tmanifestPath = candidate\n\t\t}\n\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}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/bazaar/local.go#L49-L85","documentation":"Returned by ExtractLocalPackage (kernel/bazaar/local.go:63-69) when scanning the extracted local package directory finds more than one manifest file. The function iterates localPackageManifests (plugin.json, theme.json, icon.json, template.json, widget.json) and expects exactly one match. Finding two or more (e.g. both plugin.json and theme.json) is ambiguous — the package type cannot be determined — so the extraction is aborted and cleanup() is called to remove the temp directory.","triggerScenarios":"Uploading a local marketplace package zip that contains two or more manifest files at the package root (e.g. both plugin.json and widget.json).","commonSituations":"Package author accidentally included multiple manifest files; zip was created from a directory that combines assets from different package types; manual packaging that copies manifests from different templates.","solutions":["Ensure the package contains exactly one manifest file matching its intended type","Remove all but one manifest file from the package root before zipping","Restructure the package so only the correct manifest is at the root level"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func countManifests(packagePath string) int {\n    manifests := []string{\"plugin.json\", \"theme.json\", \"icon.json\", \"template.json\", \"widget.json\"}\n    count := 0\n    for _, m := range manifests {\n        if info, err := os.Stat(filepath.Join(packagePath, m)); err == nil && info.Mode().IsRegular() {\n            count++\n        }\n    }\n    return count\n}\n// Ensure count == 1 before calling ExtractLocalPackage","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include exactly one manifest file in the package root matching its type","When packaging, verify only the intended manifest exists before zipping","Use a build script that explicitly selects the manifest file"],"tags":["bazaar","marketplace","local-package","manifest","validation","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}