golang/go · error
unknown version control system %q
Error message
unknown version control system %q
What it means
When resolving a vanity import path, the go tool reads the `<meta name="go-import">` tag which specifies a VCS type (git, hg, svn, bzr, fossil). vcsByCmd looks up the named VCS in the known list; if the name is not recognized (typo or unsupported system like 'perforce'), the lookup returns nil and this error fires.
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:871
for i, name := range srv.regexp.SubexpNames() {
if name != "" && match[name] == "" {
match[name] = m[i]
}
}
if srv.vcs != "" {
match["vcs"] = expand(match, srv.vcs)
}
if srv.repo != "" {
match["repo"] = expand(match, srv.repo)
}
if srv.check != nil {
if err := srv.check(match); err != nil {
return nil, err
}
}
vcs := vcsByCmd(match["vcs"])
if vcs == nil {
return nil, fmt.Errorf("unknown version control system %q", match["vcs"])
}
if err := checkGOVCS(vcs, match["root"]); err != nil {
return nil, err
}
var repoURL string
if !srv.schemelessRepo {
repoURL = match["repo"]
} else {
repo := match["repo"]
var ok bool
repoURL, ok = interceptVCSTest(repo, vcs, security)
if !ok {
scheme, err := func() (string, error) {
for _, s := range vcs.Scheme {
if security == web.SecureOnly && !vcs.isSecureScheme(s) {
continue
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Check the discovery page: `curl -sL https://<import-path> | grep go-import`
- If you control the vanity page, fix the VCS name in the meta tag to one of: git, hg, svn, bzr, fossil
- Use a replace directive to point directly at the repository URL
- Report the issue to the vanity path maintainer
Example fix
<!-- before: typo in VCS name --> <meta name="go-import" content="example.com/pkg get https://github.com/me/pkg"> <!-- after: correct VCS name --> <meta name="go-import" content="example.com/pkg git https://github.com/me/pkg">
Defensive patterns
Strategy: try-catch
Validate before calling
# Pre-check the go-import meta tag for VCS validity
SUPPORTED_VCS='git hg svn bzr fossil'
META=$(curl -sL "https://$IMPORT_PATH?go-get=1" | grep -oP 'go-import" content="[^"]+"' | head -1)
META_VCS=$(echo "$META" | awk '{print $3}' | tr -d '"')
for v in $SUPPORTED_VCS; do
[ "$META_VCS" = "$v" ] && echo "VCS OK: $v" && exit 0
done
echo "WARNING: unsupported VCS in meta tag: $META_VCS" Try / catch
# Detect unknown VCS error and suggest using a replace directive ERR=$(go get $IMPORT_PATH 2>&1) if echo "$ERR" | grep -q 'unknown version control system'; then echo 'The vanity path declares an unsupported VCS.' echo 'Use a replace directive in go.mod to point directly at the repository.' fi
Prevention
- Verify go-import meta tags declare a supported VCS (git, hg, svn, bzr, fossil)
- Use replace directives for repos with broken vanity pages
- Test vanity import paths with curl before scripting go get
When it happens
Trigger: A repository's go-import meta tag specifies a VCS name that isn't in the supported set: `<meta name="go-import" content="example.com/pkg perforce https://...">`, or a typo like 'get' instead of 'git'.
Common situations: Misconfigured vanity import page with a typo in the VCS field; a hosting service serving an incorrect go-import meta tag; a repository using an unsupported VCS.
Related errors
- can't decode XML document using charset %q
- %q not allowed in import path
- no %sprotocol found for repository
- invalid version control suffix in %s path
- ReadZip: encoded file exceeds allowed size
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/a6e891c28fb7702f.
Report an issue: GitHub.