composer/composer · error · RuntimeException
Could not retrieve RAR archive entries
Error message
Could not retrieve RAR archive entries
What it means
Thrown by RarDownloader::extract() (line 65-69) when $rarArchive->getEntries() returns false. The archive opened but its internal entry table could not be read, indicating structural corruption.
Source
Thrown at src/Composer/Downloader/RarDownloader.php:68
. $iniMessage . "\n" . $processError;
if (!Platform::isWindows()) {
$error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
}
throw new \RuntimeException($error);
}
$rarArchive = RarArchive::open($file);
if (false === $rarArchive) {
throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
}
$entries = $rarArchive->getEntries();
if (false === $entries) {
throw new \RuntimeException('Could not retrieve RAR archive entries');
}
foreach ($entries as $entry) {
if (false === $entry->extract($path)) {
throw new \RuntimeException('Could not extract entry');
}
}
$rarArchive->close();
return \React\Promise\resolve(null);
}
}
View on GitHub (pinned to 6ffc117740)
Solutions
- Clear cache and re-download the package to rule out a corrupt transfer
- Verify the archive opens correctly in a standalone RAR tool
- Use a zip or tar.gz dist archive instead
Defensive patterns
Strategy: retry
Try / catch
try {
$downloader->downloadAndExtract($package, $path);
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'Could not retrieve RAR archive entries')) {
$this->cache?->clear();
$downloader->downloadAndExtract($package, $path); // retry once
} else { throw $e; }
} Prevention
- Clear cache and re-download on structural archive errors
- Validate archives with a standalone rar tool before publishing
- Ship zip/tar.gz dists to avoid rar entry-table corruption issues
When it happens
Trigger: RarArchive::open() succeeded but getEntries() returns false while enumerating archive members.
Common situations: A RAR archive with a corrupt header or entry table; password-protected archive opened without a password; partial multi-volume archive.
Related errors
- Could not open RAR archive: {file}
- Could not decompress the archive, enable the PHP rar extensi
- Could not extract entry
- Installing {package} would lead to overwriting the {to}/{fil
- Failed to execute {command} {errorOutput}
AI-assisted analysis of composer/composer@6ffc117740 (2026-08-07).
Data as JSON: /api/errors/0e95315b33e1701a.
Report an issue: GitHub.