{"record":{"id":"ebdae16d8a8cedb2","repo":"deepseek-ai/deepseek-harness","slug":"subprocess-e2b-cannot-resolve-foreground-process","errorCode":null,"errorMessage":"subprocess-e2b: cannot resolve foreground process group for terminal ${this.pid}","messagePattern":"subprocess-e2b: cannot resolve foreground process group for terminal (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/e2b/subprocess-e2b/src/terminal.ts","lineNumber":323,"sourceCode":"  /** @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')\n      }\n      await this.sandbox.commands.run(\n        `kill -${signal.slice(3)} -- -${foreground.processGroupId}`,\n        commandOpts(this.controlEnvs, operationSignal),\n      )\n      return foreground.processGroupId\n    })\n  }\n\n  /** @inheritdoc */\n  terminate(): Promise<void> {\n    if (this.cleanup !== undefined) return this.cleanup\n    this.operationController.abort(new Error('subprocess-e2b: terminal is terminating'))\n    const cleanup = this.closeAfterOperations()\n    this.cleanup = cleanup","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/e2b/subprocess-e2b/src/terminal.ts#L305-L341","documentation":"Error \"subprocess-e2b: cannot resolve foreground process group for terminal ${this.pid}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/e2b/subprocess-e2b/src/terminal.ts:323 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"}