golang/go · error
%s: invalid repo root %q: %v
Error message
%s: invalid repo root %q: %v
What it means
validateRepoRoot rejected the RepoRoot field of the matched meta import. The validator requires a URL that parses, has a non-empty scheme, and whose scheme is not 'file'. The %s is resp.URL, %q is the repo root URL, %v is the validator's error (parse error, 'no scheme', or 'file scheme disallowed').
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:1054
log.Printf("get %q: verifying non-authoritative meta tag", importPath)
}
var imports []metaImport
url, imports, err = metaImportsForPrefix(mmi.Prefix, mod, security)
if err != nil {
return nil, err
}
metaImport2, err := matchGoImport(imports, importPath)
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.RepoRootView on GitHub (pinned to b6b368adc5)
Solutions
- Ensure RepoRoot is a fully-qualified URL with a supported scheme (https://, http://, git://, ssh://)
- Re-publish the meta tag with a canonical https:// repo root
Defensive patterns
Strategy: validation
Validate before calling
// Validate a repo root URL the same way cmd/go does
func validRepoRoot(s string) error {
u, err := url.Parse(s)
if err != nil { return err }
if u.Scheme == "" { return errors.New("no scheme") }
if u.Scheme == "file" { return errors.New("file scheme disallowed") }
return nil
} Prevention
- Always include a scheme (https://) in the go-import repo-root field
- Avoid SCP-like 'git@host:path' syntax; use ssh://host/path instead
When it happens
Trigger: The go-import meta tag's RepoRoot is missing a scheme, uses 'file://', is unparseable, or uses an unsupported form like 'git@host:path'.
Common situations: Vanity server emitting 'git@github.com:org/repo' (SCP-like, no scheme) or a relative URL into the repo-root field.
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: unknown vcs %q
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/2326ee926e072483.
Report an issue: GitHub.