earendil-works/pi · error · PiServerError

busy

busy

Error message

A prompt is already running

What it means

Error "A prompt is already running" thrown in earendil-works/pi.

Source

Thrown at packages/server/src/testing/service.ts:75

	private readonly onDispose: () => void;
	private readonly listeners = new Set<(event: PiSessionRuntimeEvent) => void>();
	private pendingPrompt?: { input: PromptInput; done: Deferred<"complete" | "aborted"> };

	constructor(stored: StoredSession, onDispose: () => void) {
		this.stored = stored;
		this.onDispose = onDispose;
	}

	snapshot(): SessionSnapshot {
		return structuredClone(this.stored.snapshot);
	}

	getPhase(): SessionPhase {
		return this.stored.snapshot.phase;
	}

	async prompt(input: PromptInput): Promise<void> {
		if (this.getPhase() !== "idle") throw new PiServerError("busy", "A prompt is already running");
		const done = new Deferred<"complete" | "aborted">();
		this.pendingPrompt = { input, done };
		this.update({
			phase: "turn",
			transcript: [
				...this.stored.snapshot.transcript,
				{
					id: `user-${this.stored.snapshot.revision + 1}`,
					role: "user",
					content: [{ type: "text", text: input.text }],
					timestamp: this.stored.snapshot.revision + 1,
				},
			],
		});
		const outcome = await done.promise;
		const assistant =
			outcome === "complete"
				? {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Wait for the running prompt to finish or abort it before starting another.

When it happens

Trigger: Thrown at packages/server/src/testing/service.ts:75 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/4508fcbd2cd102ec. Report an issue: GitHub.