{"record":{"id":"4795883346be5db7","repo":"deepseek-ai/deepseek-harness","slug":"pty-session-has-exited","errorCode":null,"errorMessage":"PTY session has exited","messagePattern":"PTY session has exited","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/terminal/terminal-bash/src/session.ts","lineNumber":227,"sourceCode":"  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()\n","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/terminal/terminal-bash/src/session.ts#L209-L245","documentation":"Error \"PTY session has exited\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/terminal/terminal-bash/src/session.ts:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open a new PTY session; an exited session cannot accept 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"}