can1357/oh-my-pi · error · Error

${formatVerificationFailure(verification, expectedVersion)};

Error message

${formatVerificationFailure(verification, expectedVersion)}; restored previous ${APP_NAME} launcher

What it means

Thrown during the binary/launcher self-update path when the newly installed launcher fails version verification and the updater rolls back: previously replaced launchers are restored from backup, the new executable is unlinked, and this error reports the verification failure plus the rollback. The install is left in its pre-update state.

Source

Thrown at packages/coding-agent/src/cli/update-cli.ts:1882

		// Verify the exe by its explicit path: $which cached the shim path when
		// the update target was resolved, and the shim was just renamed away, so
		// a PATH re-resolution here would test a file that no longer exists.
		const verify = options.verifyBinary ?? verifyBinaryAtPath;
		const verification = await verify(exePath, expectedVersion);
		if (!verification.ok) {
			for (const { launcher, backup } of retired) {
				try {
					await fs.promises.rename(backup, launcher);
				} catch {}
			}
			for (const { launcher, original } of forwarded) {
				try {
					await Bun.write(launcher, original);
				} catch {}
			}
			await unlinkIfExists(exePath);
			throw new Error(
				`${formatVerificationFailure(verification, expectedVersion)}; restored previous ${APP_NAME} launcher`,
			);
		}
		for (const { backup } of retired) {
			await removeBackupBestEffort(backup);
		}
		// Reclaim exe backups and retired-shim leftovers from earlier attempts.
		for (const ext of [".exe", "", ".cmd", ".ps1", ".bat"]) {
			await sweepStaleUpdateArtifacts(path.join(launcherDir, `${APP_NAME}${ext}`));
		}
	});
	for (const { launcher } of forwarded) {
		console.log(chalk.dim(`Converted ${launcher} to a forwarder (it could not be removed).`));
	}
	for (const launcher of stuck) {
		console.log(
			chalk.yellow(
				`Could not retire ${launcher}; shells that prefer it may keep launching the old version until it is deleted manually.`,

View on GitHub (pinned to 9690622007)

Solutions

  1. Read formatVerificationFailure output — it states expected vs actual version
  2. Re-run the update; a transient download truncation is the most common cause
  3. Verify you downloaded the binary matching your platform/arch
  4. Check antivirus/quarantine logs if the binary disappears or won't execute
  5. Download and run the official standalone installer manually, then retry update

Example fix

// retry with a clean download if verification failed
try {
	await updateSelf({ force: true });
} catch (err) {
	console.error(err.message); // "...; restored previous launcher" => rollback happened
	console.error("previous install intact; retry or use standalone installer");
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: confirm downloaded binary runs and reports the right version
const v = await $`${downloadedBinary} --version`.nothrow();
if (v.exitCode !== 0 || v.text().trim() !== expectedVersion) throw new Error("binary pre-flight failed");

Type guard

function isExpectedVersion(output: string, expected: string): boolean {
	return output.trim() === expected;
}

Try / catch

try {
	await updateSelf({ binary: true });
} catch (err) {
	if (err.message.includes("restored previous")) {
		// rollback happened; previous install intact — retry or use standalone installer
		console.warn("update rolled back:", err.message);
	} else throw err;
}

Prevention

When it happens

Trigger: Standalone binary update flow: launcher files were rewritten, post-install verification (run launcher, check version) fails — e.g. downloaded binary is for the wrong platform/arch, corrupted download, or the launcher shim points at the wrong executable — triggering the restore-backup + unlink branch.

Common situations: Partial/interrupted download; platform mismatch (arm64 vs x64 binary); enterprise antivirus quarantining the new binary; version mismatch because the release channel returned an unexpected version.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/16b525050f416903. Report an issue: GitHub.