golang/go · error
unknown vcs: %s %s
Error message
unknown vcs: %s %s
What it means
newVCSRepo looks up the requested VCS name in the vcsCmds map (which only contains 'hg', 'svn', 'fossil' — git is handled earlier by newGitRepo). Any other name yields this error. The two %s are the unrecognised vcs and the remote URL.
Source
Thrown at src/cmd/go/internal/modfetch/codehost/vcs.go:103
fetchOnce sync.Once
fetchErr error
fetched atomic.Bool
repoSumOnce sync.Once
repoSum string
statCache par.ErrCache[string, *RevInfo] // cache key is revision
readFileCache par.ErrCache[[2]string, []byte] // cache key is revision and file path
}
func newVCSRepo(ctx context.Context, vcs, remote string, local bool) (Repo, error) {
if vcs == "git" {
return newGitRepo(ctx, remote, local)
}
r := &vcsRepo{remote: remote, local: local}
cmd := vcsCmds[vcs]
if cmd == nil {
return nil, fmt.Errorf("unknown vcs: %s %s", vcs, remote)
}
r.cmd = cmd
if local {
info, err := os.Stat(remote)
if err != nil {
return nil, err
}
if !info.IsDir() {
return nil, fmt.Errorf("%s exists but is not a directory", remote)
}
r.dir = remote
r.mu.Path = r.dir + ".lock"
return r, nil
}
if !strings.Contains(remote, "://") {
return nil, fmt.Errorf("invalid vcs remote: %s %s", vcs, remote)
}
var err errorView on GitHub (pinned to b6b368adc5)
Solutions
- Inspect the repository's go-import meta tag and correct the vcs attribute to one of git, hg, svn, fossil.
- If the upstream truly uses an unsupported VCS, mirror it to git and update the import path or GOPROXY accordingly.
- Fetch the module through the module proxy (GOPROXY=https://proxy.golang.org) which serves a zip and never invokes the VCS code path.
Example fix
<!-- before --> <meta name="go-import" content="example.org/m vcs=bzr https://bzr.example.org/m"> <!-- after --> <meta name="go-import" content="example.org/m vcs=git https://git.example.org/m">
Defensive patterns
Strategy: validation
Validate before calling
var supportedVCS = map[string]bool{"git": true, "hg": true, "svn": true, "fossil": true}
func vcsSupported(vcs string) bool { return supportedVCS[vcs] } Prevention
- Validate go-import meta tags against the supported VCS set before relying on them.
- Prefer git for new vanity imports — it has the broadest support and is the most tested path.
- Use GOPROXY to avoid exercising the direct-VCS code path for exotic repos.
When it happens
Trigger: codehost.newVCSRepo or a caller passes a vcs string that is not 'git', 'hg', 'svn', or 'fossil'. Typically the result of a malformed vanity import meta tag or a corrupted repo metadata record.
Common situations: A go-import meta tag advertises `vcs=bzr` or `vcs=cvs`; a manually crafted module cache record names an unsupported VCS; future/typo'd VCS strings like 'github' or 'https'.
Related errors
- invalid vcs remote: %s %s
- leading slash
- no scheme
- file scheme disallowed
- %s exists but is not a directory
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/555072f1d280d08d.
Report an issue: GitHub.