parcel-bundler/parcel · error · Error
untarring failed: ${currentHeaderStart}@${filename}
Error message
untarring failed: ${currentHeaderStart}@${filename} What it means
Thrown by `untar` when the parsed `filesize` field of a tar header is `NaN`, meaning the octal-ascii size field at the current header offset is empty or non-numeric. This indicates the gzip/tar payload is corrupt, truncated, or not actually an npm package tarball.
Source
Thrown at packages/dev/repl/SimplePackageInstaller/untar.js:60
.map(c => String.fromCharCode(c))
.join('');
if (!filename) break;
let filesize = parseInt(
Array.from(
bufferSliceNull(
view,
currentHeaderStart + TAR_HEADER_OFFSETS.filesize[0],
TAR_HEADER_OFFSETS.filesize[1],
),
)
.map(c => String.fromCharCode(c))
.join(''),
8,
);
if (isNaN(filesize)) {
throw new Error(`untarring failed: ${currentHeaderStart}@${filename}`);
}
let data = view.slice(
currentHeaderStart + 512,
currentHeaderStart + 512 + filesize,
);
files.set(filename.slice('package/'.length), data);
currentHeaderStart = roundUpToMultipleOf512(
currentHeaderStart + 512 + filesize,
);
}
return files;
}
View on GitHub (pinned to 59484858a1)
Solutions
- Re-fetch the tarball — truncation/corruption is usually transient.
- Confirm the upstream fetch (error 104) actually succeeded and returned a gzip body.
- Check the `currentHeaderStart@filename` in the message: offset 0 with a garbage filename means the whole payload is wrong; a later offset means mid-tar corruption.
- If reproducible for one package, the registry tarball itself may be bad — try a different version.
Defensive patterns
Strategy: try-catch
Validate before calling
function looksLikeGzip(buf) {
return buf && buf.byteLength >= 2 && new Uint8Array(buf)[0] === 0x1f && new Uint8Array(buf)[1] === 0x8b;
} Try / catch
try { files = untar(buffer); }
catch (e) {
if (/untarring failed/.test(e.message)) { /* refetch tarball, retry once */ }
else throw e;
} Prevention
- Validate the gzip magic bytes before untarring.
- Re-fetch on untar failure rather than trusting the first download.
- Treat a non-gzip body as an upstream fetch error (HTML error page).
When it happens
Trigger: The ArrayBuffer passed to `untar` is not a gzipped tar; the gzip was partially downloaded (truncation); decompression produced garbage; tar header offsets drifted due to an earlier misparse.
Common situations: Network truncation of a tarball fetch; CDN returned an HTML error page that was fed in as the tarball; version skew between pako inflate and the payload; concurrent modification of the buffer.
Related errors
- npmFetch failed: fetching ${tarball} - ${res.status}
- npmResolve failed: fetching ${name} - ${res.status}
- npmResolve failed: resolving ${name}@${version}
- ${name}@${version}: only npm semver dependencies are current
- Cannot require '${resolved}' in the browser
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/3bcf06b56dd54d3d.
Report an issue: GitHub.