santifer/career-ops · error · Error
could not download the index
Error message
could not download the index (HTTP ${res.status}): ${url} What it means
downloadAsset throws this when the HTTP fetch of the H1B index asset returns any status other than 200. The installer refuses to persist a non-OK response (404, 403, 500, redirects not followed, etc.) as the index file. It is a guard against silently installing an error page or empty body as the published index.
Solutions
- Re-run the installer; transient 5xx/429 often resolve on retry (wait briefly if rate-limited).
- Check the URL printed in the error manually (curl -I) to confirm whether the asset still exists.
- Update the plugin or its configured index URL if the asset has moved to a new release.
- Check corporate proxy/VPN interference if every asset returns 403.
Example fix
// before
callback(res) { /* assumes res is OK */ }
// after
callback(res) {
if (res.status === 429 || res.status >= 500) return retryLater();
if (res.status !== 200) throw new Error(`index download failed: HTTP ${res.status} for ${url}`);
} Defensive patterns
Strategy: retry
Validate before calling
const head = await fetch(url, { method: 'HEAD' });
if (head.status !== 200) console.warn(`index asset not available: HTTP ${head.status}; retry later or check the URL`); Try / catch
try {
await installIndex();
} catch (e) {
if (e.message.includes('could not download the index')) {
const status = e.message.match(/HTTP (\d+)/)?.[1];
if (status === '429' || status?.startsWith('5')) await sleep(5000).then(retry);
else console.error(`asset unavailable (${status}); check the URL or update the plugin`);
}
} Prevention
- curl -I the index URL before automating installs to confirm it returns 200.
- Pin to a known-good release/tag of the index asset.
- Add exponential backoff around the installer for transient 5xx/429.
When it happens
Trigger: install-h1b-index.mjs calls downloadAsset(fetchImpl, url, tmpFile); the callback receives a Response whose res.status !== 200. Any non-200 on the index download URL produces this error, including 404 (asset moved), 403 (rate-limit/blocked), and 5xx (server error).
Common situations: The upstream index URL changed or the release asset was removed; a CDN/proxy returns 403 to the plugin's user-agent; the endpoint is temporarily down (502/503); a custom ASSET base URL is misconfigured.
Related errors
- Could not fetch job page
- could not read the release pointer
- HTTP
- HTTP
- jobbankca: all keyword request(s) failed
AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16).
Data as JSON: /api/errors/10dd5d4666ed4f6e.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/h1b-sponsor/install-h1b-index.mjs:146
// Recorded, never acted on, so a missing or odd value costs a label rather
// than the install. Bounded because it lands in a file on disk.
const version = doc.version === undefined || doc.version === null
? null
: String(doc.version).slice(0, 64);
return { filename, sha256, version };
}
/**
* Stream the asset to `tmpFile`, hashing as it goes, and return the digest.
*
* Streamed rather than buffered: the body is millions of times the size of
* anything else this plugin reads, and readBoundedText's 1 MiB ceiling exists
* precisely because nothing on the API path should ever be this big. Hashing
* during the write means the file is never read a second time to verify it.
*/
async function downloadAsset(fetchImpl, url, tmpFile) {
return fetchImpl(url, { timeoutMs: ASSET_TIMEOUT_MS }, async res => {
if (res.status !== 200) throw new Error(`could not download the index (HTTP ${res.status}): ${url}`);
const declared = Number(res.headers?.get?.('content-length'));
if (Number.isFinite(declared) && declared > MAX_INDEX_BYTES) {
throw new Error(`the published index exceeds ${MAX_INDEX_BYTES} bytes (${declared}): ${url}`);
}
if (!res.body || typeof res.body.getReader !== 'function') {
throw new Error(`the index response carried no readable body: ${url}`);
}
const hash = createHash('sha256');
const out = createWriteStream(tmpFile);
// A write failure (disk full, an unwritable target) arrives as an 'error'
// event on the stream, and an EventEmitter error with no listener is an
// uncaughtException: the CLI died on a stack trace instead of returning
// the envelope, and the cleanup that removes the partial .tmp file never
// ran. Recording the error here makes the crash impossible; the checks
// below turn it into the ordinary failure it is. once(out, 'drain') needs
// no extra wiring, it already rejects when 'error' fires mid-wait.
let writeError = null;View on GitHub (pinned to aac998c7ed)