{"record":{"id":"7edf5652c6479211","repo":"earendil-works/pi","slug":"cannot-description-while-session-is-this-phas","errorCode":null,"errorMessage":"Cannot ${description} while session is ${this.phase ?? \"unavailable\"}","messagePattern":"Cannot (.+?) while session is (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/client/remote-session.ts","lineNumber":303,"sourceCode":"\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Failed to replace remote session attachment\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.#assertNotDisposedAfterAwait(next);\n\t\tthis.#bind(next, snapshot);\n\t}\n\n\tasync #runIdleOperation(\n\t\toperation: \"setModel\" | \"setThinking\",\n\t\tdescription: string,\n\t\trun: () => Promise<void>,\n\t): Promise<void> {\n\t\tthis.#assertAvailable();\n\t\tthis.#requireHandle();\n\t\tif (this.phase !== \"idle\") {\n\t\t\tthrow new Error(`Cannot ${description} while session is ${this.phase ?? \"unavailable\"}`);\n\t\t}\n\t\tawait this.#runOperation(operation, run);\n\t}\n\n\tasync #runOperation(operation: RemoteSessionOperation, run: () => Promise<void>, preempt = false): Promise<void> {\n\t\tif (preempt) this.#assertNotDisposed();\n\t\telse this.#assertAvailable();\n\t\tconst previous = this.#lifecycle;\n\t\tconst busy: RemoteSessionLifecycle = { status: \"busy\", operation };\n\t\tthis.#lifecycle = busy;\n\t\tthis.#activeOperationStates.add(busy);\n\t\tthis.#notify();\n\t\tconst running = run();\n\t\ttry {\n\t\t\tawait Promise.race([\n\t\t\t\trunning,\n\t\t\t\tthis.#disposeSignal.then(() => {\n\t\t\t\t\tthrow new Error(\"Remote session is disposed\");","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/client/remote-session.ts#L285-L321","documentation":"Error \"Cannot ${description} while session is ${this.phase ?? \"unavailable\"}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/client/remote-session.ts:303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}