{"record":{"id":"0e95315b33e1701a","repo":"composer/composer","slug":"could-not-retrieve-rar-archive-entries","errorCode":null,"errorMessage":"Could not retrieve RAR archive entries","messagePattern":"Could not retrieve RAR archive entries","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Composer/Downloader/RarDownloader.php","lineNumber":68,"sourceCode":"                . $iniMessage . \"\\n\" . $processError;\n\n            if (!Platform::isWindows()) {\n                $error = \"Could not decompress the archive, enable the PHP rar extension.\\n\" . $iniMessage;\n            }\n\n            throw new \\RuntimeException($error);\n        }\n\n        $rarArchive = RarArchive::open($file);\n\n        if (false === $rarArchive) {\n            throw new \\UnexpectedValueException('Could not open RAR archive: ' . $file);\n        }\n\n        $entries = $rarArchive->getEntries();\n\n        if (false === $entries) {\n            throw new \\RuntimeException('Could not retrieve RAR archive entries');\n        }\n\n        foreach ($entries as $entry) {\n            if (false === $entry->extract($path)) {\n                throw new \\RuntimeException('Could not extract entry');\n            }\n        }\n\n        $rarArchive->close();\n\n        return \\React\\Promise\\resolve(null);\n    }\n}\n","sourceCodeStart":50,"sourceCodeEnd":82,"githubUrl":"https://github.com/composer/composer/blob/6ffc1177404d0c50119c22dde6564a380f4a82c9/src/Composer/Downloader/RarDownloader.php#L50-L82","documentation":"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.","triggerScenarios":"RarArchive::open() succeeded but getEntries() returns false while enumerating archive members.","commonSituations":"A RAR archive with a corrupt header or entry table; password-protected archive opened without a password; partial multi-volume archive.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $downloader->downloadAndExtract($package, $path);\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'Could not retrieve RAR archive entries')) {\n        $this->cache?->clear();\n        $downloader->downloadAndExtract($package, $path); // retry once\n    } else { throw $e; }\n}","preventionTips":["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"],"tags":["rar","archive","corrupt-download"],"analyzedSha":"6ffc1177404d0c50119c22dde6564a380f4a82c9","analyzedAt":"2026-08-07T00:01:08.491Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}