{"record":{"id":"3a36c01275d79bc9","repo":"charmbracelet/glow","slug":"can-t-find-readme-in-github-repository","errorCode":null,"errorMessage":"can't find README in GitHub repository","messagePattern":"can't find README in GitHub repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github.go","lineNumber":56,"sourceCode":"\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\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(result.DownloadURL) //nolint: noctx\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to get url: %w\", err)\n\t\t}\n\n\t\tif resp.StatusCode == http.StatusOK {\n\t\t\treturn &source{resp.Body, result.DownloadURL}, nil\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"can't find README in GitHub repository\")\n}\n","sourceCodeStart":38,"sourceCodeEnd":58,"githubUrl":"https://github.com/charmbracelet/glow/blob/e3970c813d93da1ea84edfca90c289d9afb82242/github.go#L38-L58","documentation":"findGitHubREADME queries the GitHub REST API (https://api.github.com/repos/{owner}/{repo}/readme), parses the JSON for download_url, then GETs that raw URL. This error is the terminal fallback: the API response was not HTTP 200, or the follow-up download of the README blob was not HTTP 200, so no readable source was produced. It aggregates several distinct failures (missing/private repo, rate limiting, deleted README) into one sentinel message.","triggerScenarios":"Running glow with a github.com repo URL where the repo does not exist or is private (API returns 404); exceeding GitHub's unauthenticated rate limit of ~60 requests/hour per IP (API returns 403/429, common on shared CI IPs); the readme download_url request returning any non-200 status; a repo whose default branch README was removed after the API cached a response.","commonSituations":"Typo in owner or repo segment of the URL; private repository (glow's http.Get sends no credentials or token); CI runners behind NAT that burned the shared rate budget; networks where api.github.com is reachable but raw content redirects are blocked.","solutions":["Open the same URL in a browser to confirm the repo exists, is public, and shows a README","If rate limited, wait or run from a different IP; glow makes unauthenticated API calls, so there is no token flag","Bypass the API: pass the raw file URL directly, e.g. glow https://raw.githubusercontent.com/OWNER/REPO/main/README.md","Clone the repo locally and run glow on the directory or the README.md file path"],"exampleFix":"# before\nglow https://github.com/owner/typod-repo\n\n# after (raw file skips the GitHub API entirely)\nglow https://raw.githubusercontent.com/owner/repo/main/README.md","handlingStrategy":"validation","validationCode":"func checkGitHubReadable(u *url.URL) error {\n\towner, repo, ok := strings.Cut(strings.TrimPrefix(u.Path, \"/\"), \"/\")\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid url: %s\", u)\n\t}\n\tresp, err := http.Head(fmt.Sprintf(\"https://api.github.com/repos/%s/%s/readme\", owner, repo))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"github readme endpoint returned %d (repo missing, private, or rate limited)\", resp.StatusCode)\n\t}\n\treturn nil\n}\n\n// run before calling glow with the URL:\nif err := checkGitHubReadable(u); err != nil {\n\tlog.Fatal(err)\n}","typeGuard":null,"tryCatchPattern":"src, err := findGitHubREADME(u)\nif err != nil {\n\tif err.Error() == \"can't find README in GitHub repository\" {\n\t\t// fall back to the raw CDN, which is not API-rate-limited\n\t\traw := fmt.Sprintf(\"https://raw.githubusercontent.com/%s/%s/HEAD/README.md\", owner, repo)\n\t\tsrc, err = openRawSource(raw)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rendering github readme: %w\", err)\n\t}\n}","preventionTips":["Pre-verify repo URLs with a HEAD request to api.github.com/repos/OWNER/REPO/readme before handing them to glow","Cache rendered READMEs in CI instead of re-fetching every run — unauthenticated GitHub API allows ~60 req/hour per IP","Keep a local clone as the offline source of truth and prefer file/directory arguments over network URLs in scripts"],"tags":["github","http","readme","api","rate-limit","network"],"backgroundTag":null,"analyzedSha":"e3970c813d93da1ea84edfca90c289d9afb82242","analyzedAt":"2026-08-15T22:50:54.304Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}