mozilla/pdf.js · error · Error
${response.statusText}
Error message
${response.statusText} What it means
importL10n/locales.mjs fetches the Firefox `all-locales` manifest from raw.githubusercontent.com to know which language packs to download. If the HTTP response is not OK, it throws `response.statusText` (e.g. 'Not Found', 'Too Many Requests'). This is a hard network dependency of the `gulp importl10n` task. The thrown message is whatever GitHub returned as the status reason, so it directly reflects the HTTP failure mode.
Source
Thrown at external/importL10n/locales.mjs:38
// This is used in gulpfile.js for the `importl10n` command.
const DEFAULT_LOCALE = "en-US";
const EXCLUDE_LANG_CODES = new Set(["ca-valencia", "ja-JP-mac"]);
function normalizeText(s) {
return s.replaceAll(/\r\n?/g, "\n").replaceAll("\uFEFF", "");
}
async function downloadLanguageCodes() {
console.log("Downloading language codes...\n");
const ALL_LOCALES =
"https://raw.githubusercontent.com/mozilla-firefox/firefox/main/browser/locales/all-locales";
const response = await fetch(ALL_LOCALES);
if (!response.ok) {
throw new Error(response.statusText);
}
const content = await response.text();
// Remove any leading/trailing white-space.
const langCodes = normalizeText(content.trim()).split("\n");
// Remove all locales that we don't want to download below.
return langCodes.filter(
langCode => langCode !== DEFAULT_LOCALE && !EXCLUDE_LANG_CODES.has(langCode)
);
}
async function downloadLanguageFiles(root, langCode) {
console.log(`Downloading ${langCode}...`);
// Constants for constructing the URLs. Translations are taken from the
// Nightly channel as those are the most recent ones.
const MOZ_CENTRAL_ROOT =
"https://raw.githubusercontent.com/mozilla-l10n/firefox-l10n/main/";View on GitHub (pinned to 5903d58d58)
Solutions
- Retry on a clean network connection; verify `curl -I https://raw.githubusercontent.com/mozilla-firefox/firefox/main/browser/locales/all-locales` returns 200.
- If rate-limited (429), wait or supply a GitHub token and adjust the fetch headers.
- If the URL 404s, the upstream path changed — update the `ALL_LOCALES` constant to the current location or bump PDF.js.
- Run `gulp importl10n` only when you actually need refreshed locales; commit the result so subsequent builds don't re-fetch.
Defensive patterns
Strategy: retry
Validate before calling
// Probe connectivity before running the l10n sync task.
async function assertReachable(url) {
const r = await fetch(url, { method: 'HEAD' });
if (!r.ok) throw new Error(`${url} unreachable: ${r.status} ${r.statusText}`);
} Try / catch
async function fetchWithRetry(url, attempts = 3) {
for (let i = 0; i < attempts; i++) {
const r = await fetch(url);
if (r.ok) return r;
if (r.status === 429 || r.status >= 500) await new Promise(res => setTimeout(res, 1000 * (i + 1)));
else throw new Error(`${r.status} ${r.statusText}`);
}
throw new Error('gave up after ' + attempts + ' attempts');
} Prevention
- Run `gulp importl10n` only on a clean, connected network.
- Commit downloaded locales so builds don't depend on GitHub availability.
- If the URL 404s, the upstream repo moved — update ALL_LOCALES or bump PDF.js.
When it happens
Trigger: Running `gulp importl10n` with no/slow internet; GitHub returning 404 (the mozilla-firefox/firefox repo path moved), 451/403 (region/takedown), or 429 (rate-limited); a proxy/captive portal returning a non-2xx body; DNS/TLS failure surfacing as a thrown fetch error before this line.
Common situations: CI behind a restricted network; local dev offline; the upstream Firefox repo was reorganized so the all-locales URL 404s; heavy automated l10n syncs hitting GitHub's anonymous rate limit.
Related errors
- coverage_search failed (exit code ${result.status})
- Bad begin offset: ${begin}
- Bad end offset: ${end}
- Failed to fetch file "${url}" with "${response.statusText}".
- The PDF file is empty, i.e. its size is zero bytes.
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/1013f17f41ecc2f4.
Report an issue: GitHub.