python-poetry/poetry · error · ValueError
Unsupported VCS dependency {vcs}
Error message
Unsupported VCS dependency {vcs} What it means
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.
Source
Thrown at src/poetry/packages/direct_origin.py:119
package = self.get_package_from_file(artifact)
package._source_type = "url"
package._source_url = url
return package
@staticmethod
def get_package_from_vcs(
vcs: str,
url: str,
branch: str | None = None,
tag: str | None = None,
rev: str | None = None,
subdirectory: str | None = None,
source_root: Path | None = None,
) -> Package:
if vcs != "git":
raise ValueError(f"Unsupported VCS dependency {vcs}")
return _get_package_from_git(
url=url,
branch=branch,
tag=tag,
rev=rev,
subdirectory=subdirectory,
source_root=source_root,
)
View on GitHub (pinned to 92b74dcfe3)
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.
Example fix
# before (pyproject.toml)
[tool.poetry.dependencies]
lib = { vcs = "hg", url = "https://.../lib" }
# after: mirror to git, then
lib = { git = "https://github.com/org/lib.git" }
# or vendor
lib = { path = "./vendor/lib" } Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_VCS = {'git'}
def validate_vcs(vcs: str) -> None:
if vcs not in SUPPORTED_VCS:
raise ValueError(
f'Unsupported VCS dependency {vcs!r}; only git is supported (mirror or vendor instead).'
) Type guard
def is_supported_vcs(vcs: str) -> bool:
return vcs == 'git' Try / catch
from poetry.packages.direct_origin import DirectOrigin
try:
pkg = DirectOrigin.get_package_from_vcs(vcs=vcs, url=url)
except ValueError as e:
if 'Unsupported VCS' in str(e):
raise SystemExit(f'Mirror {url} to git or vendor it; {e}') from e
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid Git parameter: {parameter}
- <error>Failed to clone <info>{url}</>, check your git config
- <error>Failed to checkout {url} at '{revision}'.</>
- <error>Failed to clone {url} at '{refspec.key}', verify ref
- <error>Failed to clone {url} at '{refspec.key}', unable to a
AI-assisted analysis of python-poetry/poetry@92b74dcfe3 (2026-08-04).
Data as JSON: /data/errors/b2453225defb6e81.json.
Report an issue: GitHub.