{"id":"b2453225defb6e81","repo":"python-poetry/poetry","slug":"unsupported-vcs-dependency-vcs","errorCode":null,"errorMessage":"Unsupported VCS dependency {vcs}","messagePattern":"Unsupported VCS dependency (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/poetry/packages/direct_origin.py","lineNumber":119,"sourceCode":"        package = self.get_package_from_file(artifact)\n\n        package._source_type = \"url\"\n        package._source_url = url\n\n        return package\n\n    @staticmethod\n    def get_package_from_vcs(\n        vcs: str,\n        url: str,\n        branch: str | None = None,\n        tag: str | None = None,\n        rev: str | None = None,\n        subdirectory: str | None = None,\n        source_root: Path | None = None,\n    ) -> Package:\n        if vcs != \"git\":\n            raise ValueError(f\"Unsupported VCS dependency {vcs}\")\n\n        return _get_package_from_git(\n            url=url,\n            branch=branch,\n            tag=tag,\n            rev=rev,\n            subdirectory=subdirectory,\n            source_root=source_root,\n        )\n","sourceCodeStart":101,"sourceCodeEnd":129,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/packages/direct_origin.py#L101-L129","documentation":"Raised by DirectOrigin.get_package_from_vcs at src/poetry/packages/direct_origin.py:118-119 when the vcs argument is not 'git'. Poetry currently supports only git for direct-origin VCS dependencies; any other value (hg, svn, bzr) is rejected. ValueError.","triggerScenarios":"Calling get_package_from_vcs(vcs='hg', url=...) or declaring a dependency with a non-git VCS URL (e.g. hg+https://...). Reached during dependency resolution for VCS-type requirements.","commonSituations":"A project migrating from Pip/setuptools that used Mercurial or Subversion dependencies; a dependency spec copied from pip's VCS syntax that uses an unsupported VCS; typo'd scheme.","solutions":["Convert the dependency to git (mirror the repo on a git host if needed).","If the VCS repo must stay non-git, vendor the code as a directory or file dependency instead.","Verify the requirement string uses git+... and that the underlying tool is git."],"exampleFix":"# before (pyproject.toml)\n[tool.poetry.dependencies]\nlib = { vcs = \"hg\", url = \"https://.../lib\" }\n\n# after: mirror to git, then\nlib = { git = \"https://github.com/org/lib.git\" }\n# or vendor\nlib = { path = \"./vendor/lib\" }","handlingStrategy":"validation","validationCode":"SUPPORTED_VCS = {'git'}\n\ndef validate_vcs(vcs: str) -> None:\n    if vcs not in SUPPORTED_VCS:\n        raise ValueError(\n            f'Unsupported VCS dependency {vcs!r}; only git is supported (mirror or vendor instead).'\n        )","typeGuard":"def is_supported_vcs(vcs: str) -> bool:\n    return vcs == 'git'","tryCatchPattern":"from poetry.packages.direct_origin import DirectOrigin\n\ntry:\n    pkg = DirectOrigin.get_package_from_vcs(vcs=vcs, url=url)\nexcept ValueError as e:\n    if 'Unsupported VCS' in str(e):\n        raise SystemExit(f'Mirror {url} to git or vendor it; {e}') from e\n    raise","preventionTips":["Use git for VCS dependencies; mirror non-git repos to a git host.","If a non-git repo must be used, vendor it as a path dependency."],"tags":["vcs","direct-origin","git","dependency","validation"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}