siyuan-note/siyuan · error

invalid marketplace package manifest

Error message

invalid marketplace package manifest

What it means

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.

Source

Thrown at kernel/bazaar/local.go:83

		if info, statErr := os.Stat(candidate); statErr == nil && info.Mode().IsRegular() {
			if manifestPath != "" {
				err = errors.New("multiple marketplace package manifests found")
				cleanup()
				return
			}
			pkgType = packageType
			manifestPath = candidate
		}
	}
	if manifestPath == "" {
		err = errors.New("marketplace package manifest not found")
		cleanup()
		return
	}

	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")
	}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Validate the manifest JSON with a JSON linter or parser before packaging
  2. Ensure all required fields (especially "name") are present and correctly typed
  3. Check for encoding issues — save the manifest as UTF-8 without BOM
  4. Compare against a known-good manifest from an existing working package
Defensive patterns

Strategy: validation

Validate before calling

func validateManifestJSON(manifestPath string) error {
    data, err := os.ReadFile(manifestPath)
    if err != nil {
        return fmt.Errorf("cannot read manifest: %w", err)
    }
    var pkg map[string]any
    if err := json.Unmarshal(data, &pkg); err != nil {
        return fmt.Errorf("manifest JSON is invalid: %w", err)
    }
    if _, ok := pkg["name"]; !ok {
        return fmt.Errorf("manifest is missing required 'name' field")
    }
    return nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/0a9571107cd1dd74. Report an issue: GitHub.