{"record":{"id":"ba83087130a18965","repo":"deepseek-ai/deepseek-harness","slug":"pty-session-is-closing","errorCode":null,"errorMessage":"PTY session is closing","messagePattern":"PTY session is closing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/terminal/terminal-bash/src/session.ts","lineNumber":226,"sourceCode":"   */\n  async initialize(signal?: AbortSignal): Promise<void> {\n    this.initializing = true\n    try {\n      const operation = this.startSend({ text: '', submit: false, ...signal !== undefined ? { signal } : {} })\n      const result = await operation.done\n      if (result.waitReason === 'session_exit') throw new Error('PTY shell exited during startup')\n      if (result.waitReason === 'timeout') throw new Error('PTY shell did not reach readiness before startup timeout')\n      this.motd = result.viewport\n    } catch (error: unknown) {\n      signal?.throwIfAborted()\n      throw error\n    } finally {\n      this.initializing = false\n    }\n  }\n\n  startSend(request: TerminalSendRequest): TerminalSendOperation {\n    if (this.closing) throw new Error('PTY session is closing')\n    if (this.statusValue.kind === 'exited') throw new Error('PTY session has exited')\n    if (this.active !== undefined) {\n      const draining = this.activeWrite !== undefined\n        ? ' or draining provider write'\n        : this.interrupting !== undefined\n          ? ' or draining foreground interrupt'\n          : ''\n      throw new TerminalError(`PTY session already has an active send${draining}`, 'SEND_ACTIVE')\n    }\n    if (request.signal?.aborted === true) throw new Error('PTY send aborted before write')\n\n    const operation = new LocalSendOperation(\n      this.config.maxReadBytes,\n      Date.now(),\n      () => { this.interrupt(operation) },\n    )\n    this.active = operation\n    this.resetReadinessEvidence()","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/terminal/terminal-bash/src/session.ts#L208-L244","documentation":"Error \"PTY session is closing\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/terminal/terminal-bash/src/session.ts:226 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the close to finish and open a new session for further I/O."],"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"}