langchain-ai/deepagents · error · MarketplaceError

File path must point to a .json marketplace file: {path}

Error message

File path must point to a .json marketplace file: {path}

What it means

When a local path exists and is a file, `_marketplace_source_from_path` requires the extension to be `.json` (marketplace.py:222-225). Marketplace definitions are JSON documents, so any other file type (YAML, TOML, markdown, or a script) is rejected with this error. The path must additionally be a real marketplace JSON (validated later); this check only enforces the extension.

Source

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

        and _GITHUB_REPO_RE.match(repo)
    ):
        return RepositoryMarketplaceSource(
            source_type="github", value=repo, ref=ref if sep else None
        )

    msg = "Invalid marketplace source format. Try: owner/repo, https://..., or ./path"
    raise MarketplaceError(msg)


def _marketplace_source_from_path(value: str) -> MarketplaceSource:
    path = Path(value).expanduser().resolve()
    if not path.exists():
        msg = f"Path does not exist: {path}"
        raise MarketplaceError(msg)
    if path.is_file():
        if path.suffix != ".json":
            msg = f"File path must point to a .json marketplace file: {path}"
            raise MarketplaceError(msg)
        return LocalMarketplaceSource(source_type="file", value=str(path))
    if path.is_dir():
        return LocalMarketplaceSource(source_type="directory", value=str(path))
    msg = f"Path is neither a file nor a directory: {path}"
    raise MarketplaceError(msg)


def _root_for_marketplace_file(path: Path) -> Path:
    for relative in _MARKETPLACE_RELATIVE_PATHS:
        if (
            len(path.parts) >= len(relative.parts)
            and path.parts[-len(relative.parts) :] == relative.parts
        ):
            return path.parents[len(relative.parts) - 1]
    return path.parent


def _load_marketplace_file(path: Path) -> PluginMarketplace:

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Point the source at the marketplace JSON file (commonly `.claude-plugin/marketplace.json`).
  2. Convert your marketplace definition to JSON with a `.json` extension.
  3. If you meant to register the whole marketplace, pass the containing directory instead of an individual non-JSON file.

Example fix

// before
add_marketplace_source("./my-plugins/marketplace.yaml")
// after
add_marketplace_source("./my-plugins/.claude-plugin/marketplace.json")
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def validate_json_file(raw: str) -> str:
    p = Path(raw).expanduser().resolve()
    if p.is_file() and p.suffix != ".json":
        raise ValueError(f"Marketplace file must be .json, got: {p.name}")
    return raw

Type guard

from pathlib import Path

def is_json_marketplace_file(value: str) -> bool:
    p = Path(value).expanduser().resolve()
    return p.is_file() and p.suffix == ".json"

Try / catch

try:
    source = parse_marketplace_source(raw)
except MarketplaceError as exc:
    if "must point to a .json" in str(exc):
        candidate = Path(raw).expanduser().resolve().parent / ".claude-plugin" / "marketplace.json"
        if candidate.exists():
            source = parse_marketplace_source(str(candidate))
        else:
            raise
    else:
        raise

Prevention

When it happens

Trigger: `parse_marketplace_source('./marketplace.yaml')`, `'./plugins.toml'`, or pointing at a README/script inside a marketplace repo, via `add_marketplace_source` or `_plugin_repository_source`.

Common situations: Authors of marketplaces in other ecosystems (YAML/TOML configs) pointing their config at the wrong file; selecting the wrong file inside a repo containing many files; exporting a marketplace in a non-JSON format.

Related errors


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