{"record":{"id":"0a3cc7e76ac35211","repo":"charmbracelet/glow","slug":"unable-to-get-url-w-0a3cc7","errorCode":null,"errorMessage":"unable to get url: %w","messagePattern":"unable to get url: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":96,"sourceCode":"\t}\n\n\t// a GitHub or GitLab URL (even without the protocol):\n\tsrc, err := readmeURL(arg)\n\tif src != nil && err == nil {\n\t\t// if there's an error, try next methods...\n\t\treturn src, nil\n\t}\n\n\t// HTTP(S) URLs:\n\tif u, err := url.ParseRequestURI(arg); err == nil && strings.Contains(arg, \"://\") { //nolint:nestif\n\t\tif u.Scheme != \"\" {\n\t\t\tif u.Scheme != \"http\" && u.Scheme != \"https\" {\n\t\t\t\treturn nil, fmt.Errorf(\"%s is not a supported protocol\", u.Scheme)\n\t\t\t}\n\t\t\t// consumer of the source is responsible for closing the ReadCloser.\n\t\t\tresp, err := http.Get(u.String()) //nolint: noctx,bodyclose\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to get url: %w\", err)\n\t\t\t}\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\treturn nil, fmt.Errorf(\"HTTP status %d\", resp.StatusCode)\n\t\t\t}\n\t\t\treturn &source{resp.Body, u.String()}, nil\n\t\t}\n\t}\n\n\t// a directory:\n\tif len(arg) == 0 {\n\t\t// use the current working dir if no argument was supplied\n\t\targ = \".\"\n\t}\n\tst, err := os.Stat(arg)\n\tif err == nil && st.IsDir() { //nolint:nestif\n\t\tvar src *source\n\t\t_ = filepath.Walk(arg, func(path string, _ os.FileInfo, err error) error {\n\t\t\tif err != nil {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/main.go#L78-L114","documentation":"glow fetches the parsed http/https URL with http.Get(u.String()). This error wraps the transport-level failure: DNS resolution errors, connection refused, TLS handshake failures, or unreachable proxy configured via HTTP(S)_PROXY. Bare http.Get uses the default client with no timeout, so failures here are immediate connection errors rather than timeouts.","triggerScenarios":"DNS cannot resolve the host; the server refuses the connection; TLS certificate errors (self-signed, expired) on https URLs; HTTP_PROXY/HTTPS_PROXY pointing at an unreachable proxy.","commonSituations":"Typos in hostnames, offline machines, corporate proxy environments with stale proxy env vars, TLS-intercepting middleboxes, firewalls blocking egress on port 443.","solutions":["curl -I the exact URL to reproduce the failure outside glow","Check DNS and connectivity: host <hostname>","Inspect HTTP_PROXY, HTTPS_PROXY and NO_PROXY values","If TLS is the cause, verify the chain: openssl s_client -connect <host>:443"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"func precheckURL(raw string) error {\n\tu, err := url.ParseRequestURI(raw)\n\tif err != nil { return err }\n\tif u.Scheme != \"http\" && u.Scheme != \"https\" {\n\t\treturn fmt.Errorf(\"unsupported scheme %q\", u.Scheme)\n\t}\n\tif _, err := net.LookupHost(u.Hostname()); err != nil { return err }\n\treturn nil\n}","typeGuard":"func isTransientNetErr(err error) bool {\n\tvar dnsErr *net.DNSError\n\tif errors.As(err, &dnsErr) { return dnsErr.IsTemporary }\n\tvar opErr *net.OpError\n\treturn errors.As(err, &opErr)\n}","tryCatchPattern":"var res *http.Response\nerr := retryN(3, time.Second, func() error {\n\tr, e := http.Get(u.String()) //nolint:noctx\n\tif e != nil { return e }\n\tres = r\n\treturn nil\n})\nif err != nil { return fmt.Errorf(\"unable to get url: %w\", err) }","preventionTips":["Retry transient GET failures with backoff at the call site","Unset broken HTTP_PROXY/HTTPS_PROXY values before invoking glow","Pre-resolve the hostname to catch DNS issues before render time"],"tags":["network","http","dns","tls","proxy"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}