earendil-works/pi · error · Error

Remote session is busy with

Error message

Remote session is busy with ${this.#lifecycle.operation}

What it means

Guard in RemoteSession.#assertAvailable: the requested operation was refused because another operation (submit, abort, reconnect, replace, setModel, setThinking) is currently in flight; the busy operation name is interpolated.

Solutions

  1. Await the in-flight operation before issuing the next one
  2. Serialize session operations through a queue
  3. Use the lifecycle notifications to know when the session leaves the busy state
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/client/remote-session.ts:403 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/c3dbd043097b1ef5. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/client/remote-session.ts:403

		}
	}

	#clearSubscriptions(): void {
		this.#unsubscribeSnapshot?.();
		this.#unsubscribeEvents?.();
		this.#unsubscribeSnapshot = undefined;
		this.#unsubscribeEvents = undefined;
	}

	#requireHandle(): SessionLease {
		if (!this.#handle) throw new Error("No remote session is attached");
		return this.#handle;
	}

	#assertAvailable(): void {
		this.#assertNotDisposed();
		if (this.#lifecycle.status === "busy") {
			throw new Error(`Remote session is busy with ${this.#lifecycle.operation}`);
		}
	}

	#assertNotDisposed(): void {
		if (this.disposed) throw new Error("Remote session is disposed");
	}

	async #assertNotDisposedAfterAwait(handle: SessionLease): Promise<void> {
		if (!this.disposed) return;
		await this.#detach(handle);
		throw new RemoteSessionDisposedError();
	}

	async #detach(handle: SessionLease): Promise<void> {
		await handle.dispose();
	}
}

View on GitHub (pinned to 4af9d21d3b)