golang/go · error
%s: unknown vcs %q
Error message
%s: unknown vcs %q
What it means
The matched meta import declares a VCS kind that is neither 'mod' nor matched by vcsByCmd against vcsList (git, hg, svn, fossil, bzr). vcsByCmd returned nil. The %s is resp.URL; %q is the unrecognized VCS string.
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:1062
if err != nil || mmi != metaImport2 {
return nil, fmt.Errorf("%s and %s disagree about go-import for %s", resp.URL, url, mmi.Prefix)
}
}
if err := validateRepoSubDir(mmi.SubDir); err != nil {
return nil, fmt.Errorf("%s: invalid subdirectory %q: %v", resp.URL, mmi.SubDir, err)
}
if err := validateRepoRoot(mmi.RepoRoot); err != nil {
return nil, fmt.Errorf("%s: invalid repo root %q: %v", resp.URL, mmi.RepoRoot, err)
}
var vcs *Cmd
if mmi.VCS == "mod" {
vcs = vcsMod
} else {
vcs = vcsByCmd(mmi.VCS)
if vcs == nil {
return nil, fmt.Errorf("%s: unknown vcs %q", resp.URL, mmi.VCS)
}
}
if err := checkGOVCS(vcs, mmi.Prefix); err != nil {
return nil, err
}
repoURL, ok := interceptVCSTest(mmi.RepoRoot, vcs, security)
if !ok {
repoURL = mmi.RepoRoot
}
rr := &RepoRoot{
Repo: repoURL,
Root: mmi.Prefix,
SubDir: mmi.SubDir,
IsCustom: true,
VCS: vcs,
}View on GitHub (pinned to b6b368adc5)
Solutions
- Set the meta tag VCS to one of: git, hg, svn, fossil, mod
- Switch the module to a supported VCS or serve it through a Go module proxy
Defensive patterns
Strategy: validation
Validate before calling
var allowedVCS = map[string]bool{"git": true, "hg": true, "svn": true, "fossil": true, "mod": true}
func validVCS(v string) bool { return allowedVCS[v] } Prevention
- Restrict the go-import VCS field to git/hg/svn/fossil/mod
- Double-check the template that renders meta tags for typos
When it happens
Trigger: A go-import meta tag lists e.g. 'github', 'perforce', or 'cvs' as the VCS field.
Common situations: Typo in the meta tag's VCS field; vanity server template bug; an unsupported/bzr-only host after bzr support was deprecated.
Related errors
- parse %s: %v
- parse %s: no go-import meta tags (%s)
- %s and %s disagree about go-import for %s
- %s: invalid subdirectory %q: %v
- %s: invalid repo root %q: %v
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/197f063bd0975e6a.
Report an issue: GitHub.