langchain-ai/deepagents · error · PluginManifestError
Invalid JSON syntax in {manifest_path}: {exc}
Error message
Invalid JSON syntax in {manifest_path}: {exc} What it means
`load_manifest` reads the plugin manifest file and `json.loads` it. A `json.JSONDecodeError` (malformed JSON) is wrapped and re-raised as `PluginManifestError` naming the manifest path and the parser's position detail. All manifest consumers (`install_plugin`, `_validate_plugin_copy`, `_plugin_from_install_path`, `auto_update_plugins`) funnel through this, so a broken manifest blocks install/load/update.
Source
Thrown at libs/code/deepagents_code/plugins/manifest.py:278
Args:
root: Plugin root directory.
fallback_name: Name to use only when deriving a manifest-less plugin.
Returns:
`(manifest, manifest_path, warnings)`.
Raises:
PluginManifestError: If the manifest exists but is invalid.
"""
manifest_path = find_manifest_path(root)
if manifest_path is None:
return None, None, ()
try:
decoded = json.loads(manifest_path.read_text(encoding="utf-8"))
except json.JSONDecodeError as exc:
msg = f"Invalid JSON syntax in {manifest_path}: {exc}"
raise PluginManifestError(msg) from exc
except OSError as exc:
msg = f"Could not read plugin manifest {manifest_path}: {exc}"
raise PluginManifestError(msg) from exc
if not isinstance(decoded, dict):
msg = f"Plugin manifest {manifest_path} must be a JSON object"
raise PluginManifestError(msg)
raw = json_object(decoded)
warnings: list[str] = []
name = _validate_name(raw.get("name"), fallback=fallback_name)
component_paths: dict[str, tuple[Path, ...]] = {}
for field_name in _PATH_COMPONENT_FIELDS:
declaration = raw.get(field_name)
if declaration is None:
continue
if field_name in {"mcpServers", "hooks"} and isinstance(declaration, dict):
continue
paths = _resolve_component_paths(declaration, root, field_name, warnings)View on GitHub (pinned to a1af029e6e)
Solutions
- Open the manifest path from the error message and fix the JSON syntax at the indicated position.
- Run `python -m json.tool <manifest>` to pinpoint the syntax error.
- If the file was truncated, restore it from the upstream plugin repo and reinstall.
- Avoid JSON5-style features (comments, trailing commas) — this parser is strict.
Example fix
// before (plugin.json)
{"name": "x", "version": "1.0",}
// after
{"name": "x", "version": "1.0"} Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
p = Path("plugin.json")
json.loads(p.read_text(encoding="utf-8")) # raises JSONDecodeError early if malformed Type guard
def is_valid_json(text: str) -> bool:
import json
try:
json.loads(text)
return True
except json.JSONDecodeError:
return False Try / catch
try:
manifest, _, _ = load_manifest(root)
except PluginManifestError as exc:
if "Invalid JSON syntax" in str(exc):
print(f"repair manifest: {exc}") # exc names path and parse position Prevention
- Run `python -m json.tool plugin.json` in CI for every manifest.
- No comments or trailing commas — strict JSON only.
- Restore from git after merge conflicts instead of committing markers.
- Avoid interrupting writes of the manifest (write-then-rename pattern in tooling).
When it happens
Trigger: Any call into `load_manifest` for a plugin root whose discovered manifest file (`plugin.json` or other supported path) contains syntactically invalid JSON — trailing commas, comments, unquoted keys, truncated file.
Common situations: Hand-edited manifest left a trailing comma; a merge conflict marker was committed; an interrupted download/write truncated the JSON; someone added `//` comments to what must be strict JSON.
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
- Plugin manifest {manifest_path} must be a JSON object
- Invalid plugin name: {name!r}
- Could not read plugin manifest {manifest_path}: {exc}
- Failed to parse {SERVER_ENV_PREFIX}{suffix} as JSON: {exc}.
- Invalid {SERVER_ENV_PREFIX}{suffix}: expected a JSON string
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/9b7793a4861fb0c8.
Report an issue: GitHub.