golang/go · error

parse %s: no go-import meta tags (%s)

Error message

parse %s: no go-import meta tags (%s)

What it means

Fired when matchGoImport returns an ImportMismatchError: meta tags exist but none has a prefix that is a path-prefix of the requested import path. The %s is resp.URL (final URL after redirects); the parenthesized %s lists the candidate prefixes that mismatched.

Source

Thrown at src/cmd/go/internal/vcs/vcs.go:1023

	defer body.Close()
	imports, err := parseMetaGoImports(body, mod)
	if len(imports) == 0 {
		if respErr := resp.Err(); respErr != nil {
			// If the server's status was not OK, prefer to report that instead of
			// an XML parse error.
			return nil, respErr
		}
	}
	if err != nil {
		return nil, fmt.Errorf("parsing %s: %v", importPath, err)
	}
	// Find the matched meta import.
	mmi, err := matchGoImport(imports, importPath)
	if err != nil {
		if _, ok := err.(ImportMismatchError); !ok {
			return nil, fmt.Errorf("parse %s: %v", url, err)
		}
		return nil, fmt.Errorf("parse %s: no go-import meta tags (%s)", resp.URL, err)
	}
	if cfg.BuildV {
		log.Printf("get %q: found meta tag %#v at %s", importPath, mmi, url)
	}
	// If the import was "uni.edu/bob/project", which said the
	// prefix was "uni.edu" and the RepoRoot was "evilroot.com",
	// make sure we don't trust Bob and check out evilroot.com to
	// "uni.edu" yet (possibly overwriting/preempting another
	// non-evil student). Instead, first verify the root and see
	// if it matches Bob's claim.
	if mmi.Prefix != importPath {
		if cfg.BuildV {
			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

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Confirm the correct import path from the module's documentation
  2. Verify the server's go-import meta tag prefix actually covers your import path (prefix must be an ancestor of the path)
  3. Update to the module's new canonical path if it was renamed
Defensive patterns

Strategy: validation

Validate before calling

// Verify the declared prefix covers the import path before resolving
func prefixCovers(prefix, importPath string) bool {
  return importPath == prefix || strings.HasPrefix(importPath, prefix+"/")
}

Prevention

When it happens

Trigger: Asking for 'example.com/foo/bar' when the server only declares 'example.com/baz'; or the declared prefix does not cover the requested subpath.

Common situations: Typo in the subpackage path; vanity server configured for a different module root; module moved and meta tags were updated to a new prefix; redirected to a host whose tags don't cover the original path.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/b7240f56a1530d9f. Report an issue: GitHub.