earendil-works/pi · error · Error
Could not verify managed Pi
Error message
Could not verify managed Pi ${expectedVersion}: ${reason} What it means
Thrown by verifyManagedRelease when the staged release's binary cannot be executed or `--version` exits non-zero. The appended reason is the spawn error message, captured stderr, or the exit code, so the smoke-test failure cause is identifiable.
Solutions
- Check the appended reason: a spawn error usually means a missing/incompatible binary for the platform
- Verify Node.js can execute the staged .bin entry manually
- Retry the update; if the downloaded release is corrupt, remove the staging directory first
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/coding-agent/src/package-manager-cli.ts:118 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/a17c8cdff270619a.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/package-manager-cli.ts:118
];
const code = await waitForChildProcess(spawnProcess("npm", args, { cwd: stageDir, stdio: "inherit" }));
if (code !== 0) throw new Error(`npm ${args.join(" ")} exited with code ${code ?? "unknown"}`);
}
function verifyManagedRelease(releaseDir: string, expectedVersion: string): void {
const binPath = join(
releaseDir,
"node_modules",
".bin",
process.platform === "win32" ? `${APP_NAME}.cmd` : APP_NAME,
);
const result = spawnProcessSync(binPath, ["--version"], {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
});
if (result.error || result.status !== 0) {
const reason = result.error?.message || result.stderr.trim() || `exit code ${result.status ?? "unknown"}`;
throw new Error(`Could not verify managed Pi ${expectedVersion}: ${reason}`);
}
const installedVersion = result.stdout.trim();
if (installedVersion !== expectedVersion) {
throw new Error(`Managed Pi smoke test returned version ${installedVersion}; expected ${expectedVersion}.`);
}
}
function activateManagedRelease(managedRoot: string, version: string): void {
const currentPath = join(managedRoot, "current-version");
const temporaryPath = join(managedRoot, `current-version.tmp.${process.pid}-${Date.now()}`);
try {
writeFileSync(temporaryPath, `${version}\n`);
renameSync(temporaryPath, currentPath);
} finally {
rmSync(temporaryPath, { force: true });
}
}
View on GitHub (pinned to 4af9d21d3b)