{"record":{"id":"4508fcbd2cd102ec","repo":"earendil-works/pi","slug":"busy","errorCode":"busy","errorMessage":"A prompt is already running","messagePattern":"A prompt is already running","errorType":"error_code","errorClass":"PiServerError","httpStatus":null,"severity":"error","filePath":"packages/server/src/testing/service.ts","lineNumber":75,"sourceCode":"\tprivate readonly onDispose: () => void;\n\tprivate readonly listeners = new Set<(event: PiSessionRuntimeEvent) => void>();\n\tprivate pendingPrompt?: { input: PromptInput; done: Deferred<\"complete\" | \"aborted\"> };\n\n\tconstructor(stored: StoredSession, onDispose: () => void) {\n\t\tthis.stored = stored;\n\t\tthis.onDispose = onDispose;\n\t}\n\n\tsnapshot(): SessionSnapshot {\n\t\treturn structuredClone(this.stored.snapshot);\n\t}\n\n\tgetPhase(): SessionPhase {\n\t\treturn this.stored.snapshot.phase;\n\t}\n\n\tasync prompt(input: PromptInput): Promise<void> {\n\t\tif (this.getPhase() !== \"idle\") throw new PiServerError(\"busy\", \"A prompt is already running\");\n\t\tconst done = new Deferred<\"complete\" | \"aborted\">();\n\t\tthis.pendingPrompt = { input, done };\n\t\tthis.update({\n\t\t\tphase: \"turn\",\n\t\t\ttranscript: [\n\t\t\t\t...this.stored.snapshot.transcript,\n\t\t\t\t{\n\t\t\t\t\tid: `user-${this.stored.snapshot.revision + 1}`,\n\t\t\t\t\trole: \"user\",\n\t\t\t\t\tcontent: [{ type: \"text\", text: input.text }],\n\t\t\t\t\ttimestamp: this.stored.snapshot.revision + 1,\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tconst outcome = await done.promise;\n\t\tconst assistant =\n\t\t\toutcome === \"complete\"\n\t\t\t\t? {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/server/src/testing/service.ts#L57-L93","documentation":"Error \"A prompt is already running\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/server/src/testing/service.ts:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the running prompt to finish or abort it before starting another."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}