Skip to content

Fix quarto install tinytex failing on GitHub API rate limit - #15388

Merged
cderv merged 5 commits into
mainfrom
fix/quarto-install-tinytex-fails-with-403-from-github-api-rate-limit-on-shared-ips
Nov 17, 2026
Merged

cderv merged 5 commits into
mainfrom
fix/quarto-install-tinytex-fails-with-403-from-github-api-rate-limit-on-shared-ips

Conversation

@cderv

@cderv cderv commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

When quarto install tinytex runs behind a shared IP (GitHub Actions runners, Docker build farms, corporate NAT), it can fail with:

Unable to determine latest release for rstudio/tinytex-releases
403 - Forbidden

Root cause

To find the latest TinyTeX release, Quarto calls the GitHub REST API (api.github.com/repos/rstudio/tinytex-releases/releases/latest). Without a token, GitHub allows 60 of these requests per hour per IP, shared by everyone behind the same address. One install made two calls (one to compare versions, one to pick the download), and quarto update tinytex made three.

Only the tag name is really needed from that response: the bundle names are derived from the tag. The TinyTeX install scripts don't hit this because they download from fixed releases/download/... URLs and never call the API.

Fix

Without a token, the latest tag now comes from the redirect that github.com/rstudio/tinytex-releases/releases/latest returns (a 302 to .../releases/tag/v2026.11), and the download URLs are built from the tag. github.com web pages have their own anonymous limits, so the API is still used when a token is set, and as a fallback when the redirect carries no tag.

As the download URLs are no longer checked against the release asset list, a HEAD request picks the first bundle name that exists (the current TinyTeX-<os>-<tag> naming, then the older one) before downloading. A failed download ends the install, so this check can't happen after.

Install and update now reuse the release they already looked up instead of fetching it again. The token lookup also reads GITHUB_TOKEN after GH_TOKEN, so a workflow exporting the Actions token under its usual name gets the authenticated API.

Checked against github.com with api.github.com blocked: release lookup and download of the Windows bundle make no request to the API.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

`quarto install tinytex` looked up rstudio/tinytex-releases through
api.github.com, whose unauthenticated limit is 60 requests per hour per
IP, and one install made two lookups (the tool summary, then
preparePackage). Behind shared egress (CI runners, Docker build farms,
corporate NAT) the install failed with "Unable to determine latest
release for rstudio/tinytex-releases 403 - Forbidden".

Without a token, the tag now comes from the 302 that
github.com/<repo>/releases/latest returns to releases/tag/<tag>, and the
download URLs are built from the tag with tinyTexPkgName(), the way the
yihui.org install scripts use fixed URLs. Those candidates are not
checked against an asset list any more, so preparePackage moves on to
the next candidate (old naming) when a download is a 404. The API stays
the path when a token is set, and the fallback when the redirect carries
no tag: github.com web endpoints have their own anonymous limits.

Install and update now pass the release info they already looked up to
preparePackage instead of fetching it again.

getLatestRelease also reads GITHUB_TOKEN, the variable GitHub Actions
provides, after GH_TOKEN.
An undefined token falls back to githubToken(), which reads GH_TOKEN,
and the test workflow sets GH_TOKEN, so on CI these tests took the
authenticated API path instead of the unauthenticated one they assert.
preparePackage tried the next candidate when a download failed with a
404, but the install context's download exits the process on any
failure, so the old-name fallback could never run. The unit test hid
this with a download stub that returned the 404 instead.

A HEAD request on each github.com download URL now picks the first
candidate that is not a 404 (github.com answers 302 for an existing
asset and 404 otherwise), and only that one is downloaded. This keeps
the install context and the other tools' download handling unchanged,
at the cost of one extra github.com request per install. A HEAD that
fails outright selects the candidate, so the download reports the real
error.
@posit-snyk-bot

posit-snyk-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv

cderv commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

I am thinking of backporting this to v1.11. The TinyTeX install code is the same in 1.11.x, so the 403 happens there too on CI runners and shared networks, and the change only touches quarto install tinytex and quarto update tinytex.

I tried cherry-picking the commits on v1.11: they apply cleanly except for the runtime boundary baseline, which has different counts on that branch, and the changelog. The TinyTeX unit tests pass there.

This is not a regression, so I kept the changelog entry under quarto install here. The backport would add it under v1.12 backports in changelog-1.11.md.

@cderv
cderv merged commit a06c0cd into main Nov 17, 2026
58 checks passed
@cderv
cderv deleted the fix/quarto-install-tinytex-fails-with-403-from-github-api-rate-limit-on-shared-ips branch November 17, 2026 14:59
cderv added a commit that referenced this pull request Nov 17, 2026
#15391)

quarto install tinytex and quarto update tinytex looked up the latest
TinyTeX release through the GitHub REST API, whose anonymous limit of
60 requests per hour per IP made installs fail
with a 403 behind shared egress such as CI runners and corporate NAT.
Without a token, the latest tag now comes from the github.com
releases redirect, and the bundle is chosen by a HEAD probe of the
candidate URLs before download.
The API is still used when GITHUB_TOKEN or GH_TOKEN is set.

- Read the latest tag from the github.com elease redirect when no token is set, and from the API otherwise.
- Build download URLs from the tag and HEAD-probe them, so the old-name
    candidate is used when the new name returns 404.
- Pass the release info from install and update to preparePackage instead of fetching it again.
- Read GITHUB_TOKEN after GH_TOKEN, the variable GitHub Actions provides.

Related to #15388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants