earendil-works/pi · error · PiServerError

session_locked

session_locked

Error message

Session runtime is terminating: ${id}

What it means

Error "Session runtime is terminating: ${id}" thrown in earendil-works/pi.

Source

Thrown at packages/server/src/sessions.ts:190

		connection: ConnectionState,
		live: LiveSession,
		operation: () => Promise<void>,
	): Promise<SessionSnapshot> {
		live.operationCount += 1;
		try {
			await operation();
			return this.forConnection(await this.broadcastSnapshot(live), connection);
		} finally {
			live.operationCount -= 1;
			this.scheduleMaybeDispose(live);
		}
	}

	private async acquire(id: string, acquireRuntime: () => Promise<PiSessionRuntime>): Promise<LiveSession> {
		for (;;) {
			const existing = this.liveSessions.get(id);
			if (existing) {
				if (existing.terminal) throw new PiServerError("session_locked", `Session runtime is terminating: ${id}`);
				if (existing.disposing) {
					await existing.disposing;
					continue;
				}
				return existing;
			}
			const opening = this.openingSessions.get(id);
			if (opening) return opening;
			const pending = this.create(id, acquireRuntime);
			this.openingSessions.set(id, pending);
			try {
				return await pending;
			} finally {
				if (this.openingSessions.get(id) === pending) this.openingSessions.delete(id);
			}
		}
	}

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The session runtime is shutting down; create a new session instead of reusing a terminating one.

When it happens

Trigger: Thrown at packages/server/src/sessions.ts:190 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/418d7482a2c4163a. Report an issue: GitHub.