{"record":{"id":"cee2ca8c68963987","repo":"deepseek-ai/deepseek-harness","slug":"terminal-process-has-exited","errorCode":null,"errorMessage":"terminal process has exited","messagePattern":"terminal process has exited","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/e2b/subprocess-e2b/src/terminal.ts","lineNumber":308,"sourceCode":"    private readonly handle: CommandHandle,\n    readonly output: PassThrough,\n    private readonly completion: Promise<CommandResult>,\n    private readonly sessionId: number,\n    private readonly controlEnvs: Record<string, string>,\n    private readonly stateDir: string,\n    private readonly graceMs: number,\n    private readonly pollMs: number,\n  ) {\n    this.pid = handle.pid\n    this.done = this.waitForCommand()\n  }\n\n  // TODO(e2b-pgid-identity): Replace retained numeric PTY/session ids when E2B\n  // exposes identity-bound input, foreground-signal, and cleanup operations.\n  /** @inheritdoc */\n  write(data: string): Promise<void> {\n    return this.trackOperation(async (signal) => {\n      if (this.topLevelExited) throw new Error('terminal process has exited')\n      await this.sandbox.pty.sendInput(this.pid, Buffer.from(data, 'utf8'), { signal })\n    })\n  }\n\n  /** @inheritdoc */\n  inspectForeground(): Promise<SubprocessTerminalForeground | undefined> {\n    return this.trackOperation(signal => this.inspectForegroundOnce(signal))\n  }\n\n  /** @inheritdoc */\n  signalForeground(signal: SubprocessTerminalSignal): Promise<number> {\n    return this.trackOperation(async (operationSignal) => {\n      const foreground = await this.inspectForegroundOnce(operationSignal)\n      if (foreground === undefined) {\n        throw new Error(`subprocess-e2b: cannot resolve foreground process group for terminal ${this.pid}`)\n      }\n      if (signal === 'SIGKILL' && foreground.processGroupId === this.pid) {\n        throw new Error('refusing to SIGKILL the terminal shell; terminate the terminal session instead')","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/e2b/subprocess-e2b/src/terminal.ts#L290-L326","documentation":"Error \"terminal process has exited\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/e2b/subprocess-e2b/src/terminal.ts:308 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":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}