{"record":{"id":"0a9571107cd1dd74","repo":"siyuan-note/siyuan","slug":"invalid-marketplace-package-manifest","errorCode":null,"errorMessage":"invalid marketplace package manifest","messagePattern":"invalid marketplace package manifest","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/bazaar/local.go","lineNumber":83,"sourceCode":"\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}\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}","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/bazaar/local.go#L65-L101","documentation":"Returned by ExtractLocalPackage (kernel/bazaar/local.go:81-84) when ParsePackageJSON fails on the found manifest file or returns nil. Unlike error 137 (no manifest found), here a manifest file was located at the expected path but its content could not be parsed — malformed JSON syntax, missing required fields, or structural incompleteness. Cleanup is called to remove the temp directory.","triggerScenarios":"A local marketplace package zip contains a manifest file at the correct location, but the file's JSON content is syntactically invalid or does not satisfy ParsePackageJSON's structural requirements.","commonSituations":"Manifest has a JSON syntax error (trailing comma, unquoted key, etc.); manifest is missing required fields like \"name\"; manifest was hand-edited and corrupted; encoding mismatch (BOM, wrong charset); empty manifest file.","solutions":["Validate the manifest JSON with a JSON linter or parser before packaging","Ensure all required fields (especially \"name\") are present and correctly typed","Check for encoding issues — save the manifest as UTF-8 without BOM","Compare against a known-good manifest from an existing working package"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func validateManifestJSON(manifestPath string) error {\n    data, err := os.ReadFile(manifestPath)\n    if err != nil {\n        return fmt.Errorf(\"cannot read manifest: %w\", err)\n    }\n    var pkg map[string]any\n    if err := json.Unmarshal(data, &pkg); err != nil {\n        return fmt.Errorf(\"manifest JSON is invalid: %w\", err)\n    }\n    if _, ok := pkg[\"name\"]; !ok {\n        return fmt.Errorf(\"manifest is missing required 'name' field\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint the manifest JSON before packaging — check syntax and required fields","Save manifest files as UTF-8 without BOM","Compare against a working package's manifest for structural reference","Test ParsePackageJSON on the manifest locally before uploading"],"tags":["bazaar","marketplace","local-package","manifest","json","validation","go"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}