{"record":{"id":"596a0bb1bece297e","repo":"deepseek-ai/deepseek-harness","slug":"pty-shell-exited-during-startup","errorCode":null,"errorMessage":"PTY shell exited during startup","messagePattern":"PTY shell exited during startup","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/terminal/terminal-bash/src/index.ts","lineNumber":135,"sourceCode":"    // function through the session and wait for the first marker prompt,\n    // which is also the readiness contract of the bash initialize path. The\n    // first send also pins UTF-8 output (the shared pwsh-local preamble)\n    // before anything runs: the session decode path treats PTY bytes as\n    // UTF-8, and an un-pinned console writes its host code page for\n    // non-ASCII output. The banner-to-prompt gap can outlast the silence\n    // bound, so the wait loops over follow-up sends until the controlled\n    // prompt is actually visible (in the viewport or the retained scrollback\n    // when it landed between sends), bounded by the send deadline.\n    let viewport = ''\n    for (;;) {\n      const first = viewport.length === 0\n      const operation = session.startSend({\n        text: first ? ENCODING_PREAMBLE + PWSH_PROMPT_SETUP : '',\n        submit: first,\n        ...signal !== undefined ? { signal } : {},\n      })\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      viewport = result.viewport\n      const scrollback = session.read({ offset: 0, count: 20 }).text\n      if (viewport.includes(CONTROLLED_PROMPT) || scrollback.includes(CONTROLLED_PROMPT)) break\n    }\n    session.motd = viewport\n  }\n  if (signal === undefined) {\n    await start()\n    return\n  }\n  const aborted = Promise.withResolvers<never>()\n  const onAbort = (): void => { aborted.reject(signal.reason) }\n  signal.addEventListener('abort', onAbort, { once: true })\n  try {\n    signal.throwIfAborted()\n    await Promise.race([start(), aborted.promise])\n  } finally {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/terminal/terminal-bash/src/index.ts#L117-L153","documentation":"Error \"PTY shell exited during startup\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/terminal/terminal-bash/src/index.ts:135 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the shell binary and its startup environment; capture the PTY output for the exit reason."],"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"}