langchain-ai/deepagents · error · MarketplaceError

Marketplace manifest {manifest_path} must be a JSON object

Error message

Marketplace manifest {manifest_path} must be a JSON object

What it means

After successfully parsing the manifest JSON, _load_marketplace_from_path requires the top-level document to be a JSON object (dict). Lists, strings, or numbers at the top level cannot carry a marketplace definition, so a MarketplaceError is raised naming the manifest path.

Source

Thrown at libs/code/deepagents_code/plugins/marketplace.py:814

        author=author,
        display_name=(
            display_name_value if isinstance(display_name_value, str) else None
        ),
    )


def _load_marketplace_from_path(root: Path, manifest_path: Path) -> PluginMarketplace:
    try:
        raw = json.loads(manifest_path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as exc:
        msg = f"Invalid JSON syntax in {manifest_path}: {exc}"
        raise MarketplaceError(msg) from exc
    except OSError as exc:
        msg = f"Could not read marketplace manifest {manifest_path}: {exc}"
        raise MarketplaceError(msg) from exc
    if not isinstance(raw, dict):
        msg = f"Marketplace manifest {manifest_path} must be a JSON object"
        raise MarketplaceError(msg)
    try:
        name = _validate_name(raw.get("name"), allow_at=False)
    except ValueError as exc:
        raise MarketplaceError(str(exc)) from exc
    plugins_raw = raw.get("plugins")
    if not isinstance(plugins_raw, list):
        msg = f"Marketplace {name} must contain a plugins array"
        raise MarketplaceError(msg)
    warnings: list[str] = []
    plugins = tuple(
        plugin
        for entry in plugins_raw
        if (plugin := _parse_entry(entry, warnings=warnings)) is not None
    )
    for warning in warnings:
        logger.warning("%s", warning)
    metadata = json_object(raw.get("metadata"))
    return PluginMarketplace(

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Wrap the manifest content in a top-level object with `name` and `plugins` keys.
  2. Validate the file with json.tool and confirm the outermost token is `{`.
  3. Regenerate the manifest from the exporter with the correct single-object schema.

Example fix

// before
[
  { "id": "my-plugin", "source": "./plugins/a" }
]
// after
{
  "name": "team-market",
  "plugins": [ { "id": "my-plugin", "source": "./plugins/a" } ]
}
Defensive patterns

Strategy: type-guard

Validate before calling

import json

def manifest_root_is_object(path) -> bool:
    raw = json.loads(path.read_text(encoding="utf-8"))
    return isinstance(raw, dict) and "name" in raw and isinstance(raw.get("plugins"), list)

Type guard

from typing import TypeGuard

def is_marketplace_doc(raw: object) -> TypeGuard[dict]:
    return isinstance(raw, dict)

Try / catch

try:
    mp = load_marketplace(root)
except MarketplaceError as exc:
    if "must be a JSON object" in str(exc):
        repair_manifest_schema(root)
    raise

Prevention

When it happens

Trigger: load_marketplace / _load_marketplace_file on a manifest whose root is not an object, e.g. the file contains `[...]`, `"text"`, or `null`.

Common situations: A manifest accidentally serialized as a JSON array of plugins; an empty file containing `null`; a tool exporting a list of marketplaces instead of a single marketplace object.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/96f563d85bd63ed5. Report an issue: GitHub.