{"record":{"id":"1e87b09744f37606","repo":"deepseek-ai/deepseek-harness","slug":"pty-session-id-is-closing","errorCode":null,"errorMessage":"PTY session ${id} is closing","messagePattern":"PTY session (.+?) is closing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/terminal/terminal/src/index.ts","lineNumber":245,"sourceCode":"   * Test whether an exact owner has a published session or unpublished spawn.\n   * @param owner - exact live owner to inspect.\n   * @returns true across the entire spawn-to-close interval, with no publication gap.\n   */\n  hasOwnerActivity(owner: Agent): boolean {\n    return (this.pendingSpawns.get(owner)?.size ?? 0) > 0\n      || [...this.sessions.values()].some(record => record.owner === owner)\n  }\n\n  /**\n   * Start one exclusive interactive send.\n   * @param owner - exact session owner.\n   * @param id - target PTY identity.\n   * @param request - explicit text, submit behavior, and cancellation.\n   * @returns live operation handle for foreground await or task registration.\n   */\n  startSend(owner: Agent, id: TerminalSessionId, request: TerminalSendRequest): TerminalSendOperation {\n    const record = this.expectOwned(owner, id)\n    if (record.closing !== undefined) throw new Error(`PTY session ${id} is closing`)\n    if (record.active !== undefined) throw new TerminalError(`PTY session ${id} already has an active send`, 'SEND_ACTIVE')\n    const operation = record.session.startSend(request)\n    record.active = operation\n    void operation.done.then(\n      () => { record.active = undefined },\n      () => { record.active = undefined },\n    )\n    return operation\n  }\n\n  /**\n   * Read one bounded scrollback page from an owned session.\n   * @param owner - exact session owner.\n   * @param id - target PTY identity.\n   * @param request - optional newest-relative offset and line count.\n   * @returns bounded retained text and pagination metadata.\n   */\n  read(owner: Agent, id: TerminalSessionId, request: TerminalReadRequest = {}): TerminalReadResult {","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/terminal/terminal/src/index.ts#L227-L263","documentation":"Error \"PTY session ${id} is closing\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/terminal/terminal/src/index.ts:245 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the session close to complete before further operations on it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}