langchain-ai/deepagents · error · MarketplaceError
Invalid JSON syntax in {manifest_path}: {exc}
Error message
Invalid JSON syntax in {manifest_path}: {exc} What it means
Marketplace manifests (.marketplace.json style files) are parsed with json.loads when loading a marketplace from a path. If the file contains malformed JSON, the underlying json.JSONDecodeError is wrapped in MarketplaceError with the file path and parser detail so callers get a single domain exception type. It is a configuration-content error, not a lookup failure.
Source
Thrown at libs/code/deepagents_code/plugins/marketplace.py:808
)
display_name_value = entry.get("displayName")
return MarketplacePluginEntry(
name=name,
source=source,
description=description_value if isinstance(description_value, str) else None,
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_rawView on GitHub (pinned to a1af029e6e)
Solutions
- Open the manifest path printed in the message and fix the JSON syntax at the line/column reported in the exc detail (validate with `python -m json.tool <file>`).
- Re-clone or re-download the marketplace repository if the file is corrupted or truncated.
- If the file is generated, regenerate it with a JSON serializer instead of string concatenation; strip BOM/comments.
Example fix
// before (broken manifest)
{ "name": "my-market", "plugins": [ { "id": "a", } ] } // trailing comma
// after
{ "name": "my-market", "plugins": [ { "id": "a" } ] } Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
def manifest_is_valid_json(path: Path) -> bool:
try:
json.loads(path.read_text(encoding="utf-8-sig"))
return True
except (json.JSONDecodeError, OSError):
return False Type guard
def is_json_object(raw: object) -> TypeGuard[dict]:
return isinstance(raw, dict) Try / catch
from deepagents_code.plugins import MarketplaceError
try:
mp = load_marketplace(root)
except MarketplaceError as exc:
logger.error("Marketplace load failed: %s", exc)
mp = None Prevention
- Always validate manifests with `python -m json.tool` or a JSON linter before committing.
- Generate manifests with json.dump rather than string templates.
- Save manifests without BOM, comments, or trailing commas.
When it happens
Trigger: Calling load_marketplace(root) / _load_marketplace_file / add_local_marketplace where find_marketplace_manifest located a manifest whose bytes are not valid JSON (json.JSONDecodeError branch in _load_marketplace_from_path).
Common situations: Hand-edited marketplace.json with a trailing comma, missing brace, or comments; a truncated download of a marketplace repo; a file saved with BOM or HTML error page content instead of JSON; merge-conflict markers left in the manifest.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse {SERVER_ENV_PREFIX}{suffix} as JSON: {exc}.
- Invalid MCP config at {mcp_config_path}: {exc}
- Marketplace manifest {manifest_path} must be a JSON object
- Invalid plugin name: {name!r}
- Marketplace {name} must contain a plugins array
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/db66a5bdc31032f1.
Report an issue: GitHub.