can1357/oh-my-pi · error · Error

Browser download stalled while writing ${destination}

Error message

Browser download stalled while writing ${destination}

What it means

Thrown by downloadArchive in packages/utils/src/browsers.ts while streaming a browser archive to disk. After each chunk write, the returned write result reports bytesWritten; a value of 0 means the filesystem accepted none of the data, so the download cannot make progress and is aborted instead of looping forever.

Source

Thrown at packages/utils/src/browsers.ts:357

	destination: string,
	onProgress: ((progress: BrowserDownloadProgress) => void) | undefined,
): Promise<void> {
	const response = await fetch(url);
	if (!response.ok || !response.body) {
		throw new Error(`Browser download failed (${response.status} ${response.statusText}) from ${url}`);
	}
	const totalBytes = Number(response.headers.get("content-length") ?? 0);
	const file = await fsp.open(destination, "wx");
	let downloadedBytes = 0;
	try {
		const reader = response.body.getReader();
		for (;;) {
			const chunk = await reader.read();
			if (chunk.done) break;
			let offset = 0;
			while (offset < chunk.value.byteLength) {
				const write = await file.write(chunk.value, offset, chunk.value.byteLength - offset, null);
				if (write.bytesWritten === 0) throw new Error(`Browser download stalled while writing ${destination}`);
				offset += write.bytesWritten;
			}
			downloadedBytes += chunk.value.byteLength;
			onProgress?.({ downloadedBytes, totalBytes });
		}
	} finally {
		await file.close();
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Free disk space (or check quota) on the volume holding the destination and retry the install.
  2. Delete any partial/stale file at `destination` and retry so a fresh handle is created.
  3. Retry the install; transient I/O stalls (e.g. sleeping external drive) often clear.
  4. If on a network mount, download to a local temp dir and move the result.

Example fix

// before
await install({ browser: 'chromium' }); // throws when disk full
// after
import { statfsSync } from 'node:fs';
const space = statfsSync(destinationDir);
if (space.bavail * space.bsize < 500 * 1024 * 1024) {
  throw new Error('Not enough disk space for browser download');
}
await install({ browser: 'chromium' });
Defensive patterns

Strategy: retry

Validate before calling

import { statfsSync } from 'node:fs';
const s = statfsSync(destinationDir);
if (s.bavail * s.bsize < 500 * 1024 * 1024) throw new Error('Insufficient disk space for browser download');

Try / catch

try {
  await install({ browser: 'chromium' });
} catch (err) {
  if (err.message.includes('download stalled')) {
    // check disk space / remove partial file, then retry once
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling install() (which calls downloadArchive) when FileHandle.write() repeatedly reports bytesWritten === 0 for a chunk — typically a full disk, an I/O error on the destination file, or the file handle becoming unwritable mid-write.

Common situations: Disk quota exceeded or volume full while installing a browser (Chromium/Firefox) into the cache dir; network filesystem or external drive dropped mid-download; corrupted destination file handle after system sleep/hibernation.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/b6e64300117cc643. Report an issue: GitHub.