{"record":{"id":"924e64a3eee98563","repo":"golang/go","slug":"https-fetch-v","errorCode":null,"errorMessage":"https fetch: %v","messagePattern":"https fetch: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/vcs/vcs.go","lineNumber":1002,"sourceCode":"\treturn &urlpkg.URL{Host: host, Path: path, RawQuery: \"go-get=1\"}, nil\n}\n\n// repoRootForImportDynamic finds a *RepoRoot for a custom domain that's not\n// statically known by repoRootFromVCSPaths.\n//\n// This handles custom import paths like \"name.tld/pkg/foo\" or just \"name.tld\".\nfunc repoRootForImportDynamic(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error) {\n\turl, err := urlForImportPath(importPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := web.Get(security, url)\n\tif err != nil {\n\t\tmsg := \"https fetch: %v\"\n\t\tif security == web.Insecure {\n\t\t\tmsg = \"http/\" + msg\n\t\t}\n\t\treturn nil, fmt.Errorf(msg, err)\n\t}\n\tbody := resp.Body\n\tdefer body.Close()\n\timports, err := parseMetaGoImports(body, mod)\n\tif len(imports) == 0 {\n\t\tif respErr := resp.Err(); respErr != nil {\n\t\t\t// If the server's status was not OK, prefer to report that instead of\n\t\t\t// an XML parse error.\n\t\t\treturn nil, respErr\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing %s: %v\", importPath, err)\n\t}\n\t// Find the matched meta import.\n\tmmi, err := matchGoImport(imports, importPath)\n\tif err != nil {\n\t\tif _, ok := err.(ImportMismatchError); !ok {","sourceCodeStart":984,"sourceCodeEnd":1020,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/vcs/vcs.go#L984-L1020","documentation":"Thrown by Go's dynamic import-path discovery (repoRootForImportDynamic) when the initial HTTPS GET used to fetch go-import meta tags fails at the transport level. The wrapped %v carries the underlying net/http, TLS, or DNS error from web.Get. The message is prefixed with 'http/' only when security == web.Insecure (the GOINSECURE/GOPRIVATE path).","triggerScenarios":"Running `go get`, `go install`, or `go mod download` against a vanity import path (e.g. 'example.com/pkg') when the request to the constructed URL (https://<importPath>?go-get=1) cannot complete: connection refused, TLS handshake failure, DNS NXDOMAIN, proxy timeout, or cert validation error.","commonSituations":"Air-gapped or corporate-proxied networks blocking HTTPS; expired/self-signed TLS certs on the vanity server; typo in the import-path domain; GOINSECURE not set for an HTTP-only private host; GOPROXY=off combined with a non-module path; captive portal intercepting TLS.","solutions":["Verify the host serves go-import meta tags: curl -v 'https://<importPath>?go-get=1'","For private HTTP-only hosts, set GOINSECURE=<host> (and GOPRIVATE=<host>) and confirm meta tags are present","Check TLS validity with curl -v and inspect HTTPS_PROXY/HTTP_PROXY env","Confirm DNS resolves and that no MITM proxy is terminating TLS"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Preflight reachability check before relying on dynamic discovery\nimport (\n  \"crypto/tls\"\n  \"fmt\"\n  \"net/http\"\n  \"time\"\n)\nfunc reachable(u string) error {\n  c := &http.Client{Timeout: 10 * time.Second,\n    Transport: &http.Transport{TLSClientConfig: &tls.Config{}}}\n  r, err := c.Get(u + \"?go-get=1\")\n  if err != nil { return err }\n  defer r.Body.Close()\n  if r.StatusCode != 200 { return fmt.Errorf(\"status %d\", r.StatusCode) }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Curate GOPRIVATE/GONOSUMCHECK/GONOSUMDB to route private hosts off the public proxy","Pin GOPROXY with a corporate mirror that you control for offline/air-gapped builds","For HTTP-only internal hosts, set GOINSECURE explicitly rather than globally downgrading"],"tags":["go","modules","network","vcs","tls"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}