{"record":{"id":"56b63360aa0155c3","repo":"langchain-ai/deepagents","slug":"file-path-must-point-to-a-json-marketplace-file","errorCode":null,"errorMessage":"File path must point to a .json marketplace file: {path}","messagePattern":"File path must point to a \\.json marketplace file: (.+?)","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":225,"sourceCode":"        and _GITHUB_REPO_RE.match(repo)\n    ):\n        return RepositoryMarketplaceSource(\n            source_type=\"github\", value=repo, ref=ref if sep else None\n        )\n\n    msg = \"Invalid marketplace source format. Try: owner/repo, https://..., or ./path\"\n    raise MarketplaceError(msg)\n\n\ndef _marketplace_source_from_path(value: str) -> MarketplaceSource:\n    path = Path(value).expanduser().resolve()\n    if not path.exists():\n        msg = f\"Path does not exist: {path}\"\n        raise MarketplaceError(msg)\n    if path.is_file():\n        if path.suffix != \".json\":\n            msg = f\"File path must point to a .json marketplace file: {path}\"\n            raise MarketplaceError(msg)\n        return LocalMarketplaceSource(source_type=\"file\", value=str(path))\n    if path.is_dir():\n        return LocalMarketplaceSource(source_type=\"directory\", value=str(path))\n    msg = f\"Path is neither a file nor a directory: {path}\"\n    raise MarketplaceError(msg)\n\n\ndef _root_for_marketplace_file(path: Path) -> Path:\n    for relative in _MARKETPLACE_RELATIVE_PATHS:\n        if (\n            len(path.parts) >= len(relative.parts)\n            and path.parts[-len(relative.parts) :] == relative.parts\n        ):\n            return path.parents[len(relative.parts) - 1]\n    return path.parent\n\n\ndef _load_marketplace_file(path: Path) -> PluginMarketplace:","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L207-L243","documentation":"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.","triggerScenarios":"`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`.","commonSituations":"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.","solutions":["Point the source at the marketplace JSON file (commonly `.claude-plugin/marketplace.json`).","Convert your marketplace definition to JSON with a `.json` extension.","If you meant to register the whole marketplace, pass the containing directory instead of an individual non-JSON file."],"exampleFix":"// before\nadd_marketplace_source(\"./my-plugins/marketplace.yaml\")\n// after\nadd_marketplace_source(\"./my-plugins/.claude-plugin/marketplace.json\")","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef validate_json_file(raw: str) -> str:\n    p = Path(raw).expanduser().resolve()\n    if p.is_file() and p.suffix != \".json\":\n        raise ValueError(f\"Marketplace file must be .json, got: {p.name}\")\n    return raw","typeGuard":"from pathlib import Path\n\ndef is_json_marketplace_file(value: str) -> bool:\n    p = Path(value).expanduser().resolve()\n    return p.is_file() and p.suffix == \".json\"","tryCatchPattern":"try:\n    source = parse_marketplace_source(raw)\nexcept MarketplaceError as exc:\n    if \"must point to a .json\" in str(exc):\n        candidate = Path(raw).expanduser().resolve().parent / \".claude-plugin\" / \"marketplace.json\"\n        if candidate.exists():\n            source = parse_marketplace_source(str(candidate))\n        else:\n            raise\n    else:\n        raise","preventionTips":["Point sources at the conventional `.claude-plugin/marketplace.json` location, or at the repo directory.","Convert YAML/TOML marketplace definitions to JSON before registering them.","When in doubt, register the containing directory instead of an individual file."],"tags":["filesystem","validation","json"],"backgroundTag":"invalid-marketplace-source","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}