earendil-works/pi · error · Error
Binary not found in archive: expected
Error message
Binary not found in archive: expected ${binaryFileName} under ${extractDir} What it means
Thrown by downloadTool after successful extraction when the expected binary file cannot be found at either the archive-root or the versioned-subdirectory candidate path, meaning the archive layout differs from what the installer expects.
Solutions
- Install the tool (fd/rg) manually via the system package manager
- Check the downloaded archive's layout and report the discrepancy
- Retry in case of a corrupted download/extraction
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/coding-agent/src/utils/tools-manager.ts:303 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/84c14df2e0a25a9f.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/utils/tools-manager.ts:303
} else {
throw new Error(`Unsupported archive format: ${assetName}`);
}
// Find the binary in extracted files. Some archives contain files directly
// at root, others nest under a versioned subdirectory.
const binaryFileName = config.binaryName + binaryExt;
const extractedDir = join(extractDir, assetName.replace(/\.(tar\.gz|zip)$/, ""));
const extractedBinaryCandidates = [join(extractedDir, binaryFileName), join(extractDir, binaryFileName)];
let extractedBinary = extractedBinaryCandidates.find((candidate) => existsSync(candidate));
if (!extractedBinary) {
extractedBinary = findBinaryRecursively(extractDir, binaryFileName) ?? undefined;
}
if (extractedBinary) {
renameSync(extractedBinary, binaryPath);
} else {
throw new Error(`Binary not found in archive: expected ${binaryFileName} under ${extractDir}`);
}
// Make executable (Unix only)
if (plat !== "win32") {
chmodSync(binaryPath, 0o755);
}
} finally {
// Cleanup
rmSync(archivePath, { force: true });
rmSync(extractDir, { recursive: true, force: true });
}
return binaryPath;
}
// Termux package names for tools
const TERMUX_PACKAGES: Record<string, string> = {
fd: "fd",View on GitHub (pinned to 4af9d21d3b)