santifer/career-ops · error · Error

the published index exceeds

Error message

the published index exceeds ${MAX_INDEX_BYTES} bytes: ${url}

What it means

downloadAsset throws this when the streamed body's accumulated byte count exceeds MAX_INDEX_BYTES, even though no (or a lying) content-length header declared it. It enforces the size cap mid-stream, cancelling the reader before discarding the partial file.

Solutions

  1. Confirm the download URL serves the genuine index; a mirror or proxy may be serving different content.
  2. If the official index legitimately grew, raise MAX_INDEX_BYTES in the plugin to the new bound.
  3. Retry against the default endpoint to rule out a tampered custom asset source.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

const head = await fetch(url, { method: 'HEAD' });
const len = Number(head.headers.get('content-length'));
console.log(`expected index size: ${Number.isFinite(len) ? len + ' bytes' : 'unknown (chunked)'}`);

Try / catch

try {
  await installIndex();
} catch (e) {
  if (e.message.includes('exceeds') && e.message.includes('bytes')) {
    console.error('Streamed body exceeded the cap mid-download; verify the mirror/endpoint integrity.');
  }
}

Prevention

When it happens

Trigger: During the reader.read() loop in downloadAsset, total (sum of chunk byteLengths) exceeds MAX_INDEX_BYTES. Triggered when the server omits content-length (chunked encoding) or lies about it, and the actual body is oversized.

Common situations: A chunked-transfer response from a misconfigured or malicious mirror; upstream republishes a far larger index without updating the cap; a redirect chain ends at the wrong (huge) file.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/24537c6405f28e6f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/h1b-sponsor/install-h1b-index.mjs:180

    // 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;
    out.on('error', err => { writeError = err; });
    const reader = res.body.getReader();
    let total = 0;
    try {
      for (;;) {
        if (writeError) {
          await reader.cancel().catch(() => {});
          throw writeError;
        }
        const { done, value } = await reader.read();
        if (done) break;
        if (!value) continue;
        total += value.byteLength;
        if (total > MAX_INDEX_BYTES) {
          await reader.cancel().catch(() => {});
          throw new Error(`the published index exceeds ${MAX_INDEX_BYTES} bytes: ${url}`);
        }
        hash.update(value);
        // Respect backpressure: an 8 MiB body written without it queues the
        // whole file in memory, which is the thing streaming was for.
        if (!out.write(value)) await once(out, 'drain');
      }
    } finally {
      await new Promise(resolve => out.end(resolve));
    }
    // end() above flushes the tail, so a failure during that flush, or one
    // that raced the final read, is only visible here. The digest must not
    // vouch for bytes that never landed on disk.
    if (writeError) throw writeError;
    return { digest: hash.digest('hex'), bytes: total };
  });
}

/**

View on GitHub (pinned to aac998c7ed)