earendil-works/pi · error · Error

Another managed Pi update is already running.

Error message

Another managed Pi update is already running.

What it means

runManagedSelfUpdate takes a lockfile in the managed root; ELOCKED means another managed update process currently holds the lock, so this update attempt is refused rather than run concurrently.

Solutions

  1. Wait for the concurrent update to finish and retry
  2. Check for a stuck update process and end it, then retry
  3. Remove the stale lock file only if no update process is running
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/coding-agent/src/package-manager-cli.ts:181 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/320e5ff85be1920e. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/package-manager-cli.ts:181

		} finally {
			releaseLock();
		}
	} catch {
		// A live update owns the staging directory, or cleanup is unavailable.
	}
}

async function runManagedSelfUpdate(managedRoot: string, version: string): Promise<void> {
	if (!MANAGED_RELEASE_VERSION_RE.test(version)) {
		throw new Error(`Invalid managed release version: ${version}`);
	}

	let releaseLock: () => Promise<void>;
	try {
		releaseLock = await lockfile.lock(join(managedRoot, "update"), { realpath: false });
	} catch (error: unknown) {
		if (error instanceof Error && "code" in error && error.code === "ELOCKED") {
			throw new Error("Another managed Pi update is already running.");
		}
		throw error;
	}

	let stageDir: string | undefined;
	try {
		cleanupManagedStaging(managedRoot);
		const installerApiBase = (process.env.PI_INSTALLER_API_BASE?.trim() || DEFAULT_INSTALLER_API_BASE).replace(
			/\/+$/,
			"",
		);
		const releaseUrl = `${installerApiBase}/${encodeURIComponent(version)}`;
		const stagingRoot = join(managedRoot, "staging");
		const releasesRoot = join(managedRoot, "releases");
		mkdirSync(releasesRoot, { recursive: true });
		const releaseDir = join(releasesRoot, version);
		if (existsSync(releaseDir)) {
			verifyManagedRelease(releaseDir, version);

View on GitHub (pinned to 4af9d21d3b)