{"record":{"id":"928ae98c1a474bf3","repo":"charmbracelet/glow","slug":"unable-to-get-url-w-928ae9","errorCode":null,"errorMessage":"unable to get url: %w","messagePattern":"unable to get url: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitlab.go","lineNumber":32,"sourceCode":"func findGitLabREADME(u *url.URL) (*source, error) {\n\towner, repo, ok := strings.Cut(strings.TrimPrefix(u.Path, \"/\"), \"/\")\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid url: %s\", u.String())\n\t}\n\n\tprojectPath := url.QueryEscape(owner + \"/\" + repo)\n\n\ttype readme struct {\n\t\tReadmeURL string `json:\"readme_url\"`\n\t}\n\n\tapiURL := fmt.Sprintf(\"https://%s/api/v4/projects/%s\", u.Hostname(), projectPath)\n\n\t//nolint:bodyclose\n\t// it is closed on the caller\n\tres, err := http.Get(apiURL) //nolint: gosec,noctx\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get url: %w\", err)\n\t}\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to read http response body: %w\", err)\n\t}\n\n\tvar result readme\n\tif err := json.Unmarshal(body, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse json: %w\", err)\n\t}\n\n\treadmeRawURL := strings.ReplaceAll(result.ReadmeURL, \"blob\", \"raw\")\n\n\tif res.StatusCode == http.StatusOK {\n\t\t//nolint:bodyclose\n\t\t// it is closed on the caller\n\t\tresp, err := http.Get(readmeRawURL) //nolint: gosec,noctx","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/gitlab.go#L14-L50","documentation":"This wraps the failure of http.Get(apiURL) where apiURL is https://{hostname}/api/v4/projects/{url.QueryEscape(owner + \"/\" + repo)} — for gitlab.com that is the public projects endpoint. As with any net/http transport error, it means DNS, connection, TLS, or proxy failure; no HTTP response was obtained, so no status code exists yet.","triggerScenarios":"DNS failure resolving gitlab.com; blocked or timed-out connection to port 443; HTTPS_PROXY pointing at an unreachable proxy; TLS interception with an untrusted CA breaking the handshake; self-hosted GitLab hostnames that do not resolve or are internal-only.","commonSituations":"Firewalled/air-gapped environments without GitLab egress; corporate proxies requiring custom CAs not in the system trust store; VPN split-tunnel dropping the GitLab route; containers missing CA certificates.","solutions":["Test reachability: curl -v \"https://gitlab.com/api/v4/projects/owner%2Frepo\"","Fix or unset HTTPS_PROXY/HTTP_PROXY if the proxy is the failure point","Install the proxy's CA into the system trust store (update-ca-certificates / update-ca-trust)","For self-hosted GitLab, confirm the hostname resolves from this machine and is not VPN-only; otherwise run glow on local files"],"exampleFix":"# before\nglow https://gitlab.com/owner/repo\n# Error: unable to get url: Get \"https://gitlab.com/api/v4/...\": dial tcp: lookup gitlab.com: no such host\n\n# after\n$ resolvectl flush-caches && curl -sI https://gitlab.com >/dev/null && glow https://gitlab.com/owner/repo","handlingStrategy":"retry","validationCode":"// confirm the projects endpoint answers before invoking glow\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nprobe := fmt.Sprintf(\"https://%s/api/v4/projects\", u.Hostname())\nreq, _ := http.NewRequestWithContext(ctx, http.MethodHead, probe, nil)\nif _, err := http.DefaultClient.Do(req); err != nil {\n\treturn fmt.Errorf(\"%s unreachable (DNS/proxy/firewall?): %w\", probe, err)\n}","typeGuard":null,"tryCatchPattern":"err := retry(3, 400*time.Millisecond, func() error {\n\tvar err error\n\tsrc, err = findGitLabREADME(u)\n\tif err != nil && strings.Contains(err.Error(), \"unable to get url\") {\n\t\tvar ue *url.Error\n\t\tif errors.As(err, &ue) && (ue.Timeout() || errors.Is(ue, syscall.ECONNREFUSED) || errors.Is(ue, syscall.EAI_AGAIN)) {\n\t\t\treturn err // transport-level: retry with backoff\n\t\t}\n\t}\n\treturn err\n})\nif err != nil {\n\treturn nil, fmt.Errorf(\"gitlab api unreachable after retries: %w\", err)\n}","preventionTips":["Verify DNS and 443 reachability for the GitLab host (curl -I https://gitlab.com/api/v4/projects) in new environments","For self-hosted GitLab, confirm the hostname resolves off-VPN or connect the VPN before running glow","Install proxy CA bundles and set HTTPS_PROXY correctly where interception is unavoidable"],"tags":["network","http","dns","proxy","tls","gitlab"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}