iOfficeAI/AionUi · error · Error

update.errors.downloadNoBody

update.errors.downloadNoBody

Error message

update.errors.downloadNoBody

What it means

Thrown when the update artifact download response has status ok but an empty body (res.body is null). The download cannot proceed because there is nothing to stream to disk.

Source

Thrown at packages/desktop/src/process/bridge/updateBridge.ts:535

  let stream: fs.WriteStream | null = null;
  try {
    const res = await fetchWithAllowlistedRedirects(url, abortController.signal);

    if (!res.ok) {
      throw new Error((await getI18n()).t('update.errors.downloadFailed', { status: res.status }));
    }

    const contentLengthHeader = res.headers.get('content-length');
    if (contentLengthHeader) {
      const parsed = parseInt(contentLengthHeader, 10);
      if (Number.isFinite(parsed) && parsed > 0) {
        totalBytes = parsed;
      }
    }

    if (!res.body) {
      throw new Error((await getI18n()).t('update.errors.downloadNoBody'));
    }

    stream = fs.createWriteStream(file_path);
    const reader = res.body.getReader();

    let doneReading = false;
    while (!doneReading) {
      const { done, value } = await reader.read();
      doneReading = done;
      if (doneReading) break;
      if (!value) continue;

      receivedBytes += value.byteLength;

      const buf = Buffer.from(value);
      if (!stream.write(buf)) {
        await new Promise<void>((resolve) => stream?.once('drain', () => resolve()));
      }

View on GitHub (pinned to 711aa0550e)

Solutions

  1. curl -v the artifact URL and inspect status, Content-Length and redirect chain
  2. If a redirect ends in an empty response, fix the allowlisted-redirect target on the CDN
  3. Retry after CDN propagation completes
  4. Check for Node/Electron version-specific undici behaviors with empty bodies if persistent
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(url);
if (!res.body || (res.headers.get('content-length') ?? '1') === '0') {
  // skip streaming; treat as bad artifact and refetch manifest
}

Try / catch

catch (err) { if (err.message.includes('downloadNoBody')) { /* re-resolve manifest and retry once */ } throw err; }

Prevention

When it happens

Trigger: A 2xx response with Content-Length 0 or a body stream the runtime could not materialize — e.g. a HEAD-like empty response, a redirect chain that ends in an empty 200, or a fetch polyfill/undici quirk returning null body.

Common situations: CDN edge returning empty 200 during propagation, misconfigured redirect target, or Node fetch (undici) returning null body for unusual responses (204/empty content-type edge cases).

Related errors


AI-assisted analysis of iOfficeAI/AionUi@711aa0550e (2026-08-28). Data as JSON: /api/errors/c9fb788081aa3bf1. Report an issue: GitHub.