golang/go · error
no scheme
Error message
no scheme
What it means
validateRepoRoot parses the repo root as a URL and requires a non-empty scheme. An empty scheme means the value looks like a bare path/host rather than a fully-qualified URL (e.g. `github.com/u/r` instead of `https://github.com/u/r`).
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:1108
}
if subdir[0] == '/' {
return errors.New("leading slash")
}
if subdir[0] == '-' {
return errors.New("leading hyphen")
}
return nil
}
// validateRepoRoot returns an error if repoRoot does not seem to be
// a valid URL with scheme.
func validateRepoRoot(repoRoot string) error {
url, err := urlpkg.Parse(repoRoot)
if err != nil {
return err
}
if url.Scheme == "" {
return errors.New("no scheme")
}
if url.Scheme == "file" {
return errors.New("file scheme disallowed")
}
return nil
}
var fetchGroup singleflight.Group
var (
fetchCacheMu sync.Mutex
fetchCache = map[string]fetchResult{} // key is metaImportsForPrefix's importPrefix
)
// metaImportsForPrefix takes a package's root import path as declared in a <meta> tag
// and returns its HTML discovery URL and the parsed metaImport lines
// found on the page.
//
// The importPath is of the form "golang.org/x/tools".View on GitHub (pinned to b6b368adc5)
Solutions
- Add a scheme (https, git, ssh) to the repo root in the meta tag.
- Fix the vanity server to emit fully-qualified URLs.
Example fix
<!-- before --> <meta name="go-import" content="example.com git github.com/u/r"> <!-- after --> <meta name="go-import" content="example.com git https://github.com/u/r">
Defensive patterns
Strategy: validation
Validate before calling
// Ensure vanity repo roots carry a scheme.
func validRepoRoot(root string) error {
u, err := url.Parse(root)
if err != nil { return err }
if u.Scheme == "" { return errors.New("repo root needs a scheme (https/git/ssh)") }
return nil
} Type guard
null
Try / catch
null
Prevention
- Always include the scheme in go-import repo roots.
- Validate meta-tag output from vanity servers with `go get -v`.
When it happens
Trigger: A vanity meta tag or VCS path config supplies a repo root with no scheme.
Common situations: Hand-authored `<meta name="go-import">` tags missing the protocol; legacy vanity servers.
Related errors
- file scheme disallowed
- leading slash
- import path does not begin with hostname
- leading hyphen
- value is neither 'auto' nor a valid bool
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/d7c467c9e4afd9e3.
Report an issue: GitHub.