{"record":{"id":"62fdd33ac9670662","repo":"langchain-ai/deepagents","slug":"invalid-marketplace-source-format-try-owner-repo","errorCode":null,"errorMessage":"Invalid marketplace source format. Try: owner/repo, https://..., or ./path","messagePattern":"Invalid marketplace source format\\. Try: owner/repo, https://\\.\\.\\., or \\./path","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":214,"sourceCode":"    # Bare relative paths such as `marketplace` (no ./ prefix) are accepted when\n    # they exist on disk, before GitHub-shorthand parsing.\n    candidate = Path(value).expanduser()\n    if candidate.exists():\n        return _marketplace_source_from_path(value)\n\n    repo, sep, ref = value.replace(\"#\", \"@\", 1).partition(\"@\")\n    if (\n        \"/\" in value\n        and \":\" not in value\n        and not value.startswith(\"@\")\n        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","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L196-L232","documentation":"This is the terminal fallback of `parse_marketplace_source` (marketplace.py:213-214): after SSH Git syntax, http/https URLs, path-like prefixes, existing relative paths, and the `owner/repo` GitHub shorthand have all been tried, any remaining unrecognized string raises this error. The message enumerates the three accepted shapes. It is a `MarketplaceError` (a `ValueError` subclass) raised whenever no grammar branch matches.","triggerScenarios":"`parse_marketplace_source('my marketplace')` (space, no separator), `'owner:repo'` (colon in a non-URL string), `'@org/repo'` (leading `@`, explicitly excluded), `'owner/repo@'` styles that fail `_GITHUB_REPO_RE`, or `add_marketplace_source` with a typo'd bare name like `'my-marketplaec'` that does not exist on disk.","commonSituations":"Typos in GitHub `owner/repo` shorthand (extra slashes or spaces); Windows-style paths typed without a recognizable prefix; pasting a full SCP URL with extra characters; forgetting `./` before a relative directory that does not exist.","solutions":["Use the GitHub shorthand form `owner/repo` for GitHub-hosted marketplaces.","Use a full `https://...` URL for remote marketplaces (with `#ref` optionally appended).","Prefix local paths with `./`, `../`, `/`, or `~` (or make sure the relative path actually exists on disk).","Check for stray characters: spaces, colons, or a leading `@` all disqualify the GitHub shorthand branch."],"exampleFix":"// before\nadd_marketplace_source(\"my marketplace\")\n// after\nadd_marketplace_source(\"owner/repo\")","handlingStrategy":"validation","validationCode":"import re\n\n_GITHUB_SHORT = re.compile(r\"^[^/\\s]+/[^/\\s]+$\")\n\ndef validate_source_shape(raw: str) -> str:\n    v = raw.strip()\n    if not (v.startswith((\"https://\", \"./\", \"../\", \"/\", \"~\"))\n            or (\":\" not in v and not v.startswith(\"@\") and _GITHUB_SHORT.match(v.split(\"#\", 1)[0].replace(\"@\", \"/\", 0) or v))):\n        raise ValueError(f\"Unsupported source format: {raw!r}\")\n    return raw","typeGuard":"import re\n\ndef looks_like_valid_source(value: str) -> bool:\n    v = value.strip()\n    if v.startswith((\"https://\", \"./\", \"../\", \"/\", \"~\")):\n        return True\n    return bool(re.fullmatch(r\"[^/\\s]+/[^/\\s]+\", v)) and \":\" not in v and not v.startswith(\"@\")","tryCatchPattern":"try:\n    source = parse_marketplace_source(raw)\nexcept MarketplaceError as exc:\n    if \"Invalid marketplace source format\" in str(exc):\n        raise ValueError(\n            f\"{exc}. Accepted forms: 'owner/repo', 'https://.../marketplace.json', or './local/path'\"\n        ) from exc\n    raise","preventionTips":["Normalize user input: trim whitespace and strip a leading '@' before passing sources.","Show the accepted formats in UI/config docs next to the field.","Prefer the GitHub `owner/repo` shorthand; it avoids most formatting mistakes."],"tags":["validation","input-parsing","marketplace"],"backgroundTag":"invalid-marketplace-source","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}