{"record":{"id":"a1e421600f93bab5","repo":"deepseek-ai/deepseek-harness","slug":"subprocess-e2b-remote-wrapper-published-invalid-e","errorCode":null,"errorMessage":"subprocess-e2b: remote wrapper published invalid exit code ${JSON.stringify(rawStatus)}","messagePattern":"subprocess-e2b: remote wrapper published invalid exit code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/e2b/subprocess-e2b/src/process.ts","lineNumber":527,"sourceCode":"  }\n\n  private async waitForCommand(\n    sandbox: Sandbox,\n    handle: CommandHandle,\n    completion: Promise<CommandResult>,\n  ): Promise<SubprocessOutcome> {\n    const settlement = completion.then<CommandSettlement, CommandSettlement>(\n      result => ({ kind: 'result', result }),\n      (error: unknown) => ({ kind: 'error', error }),\n    )\n    const hasPipeOutput = this.spec.stdio.stdout === 'pipe' || this.spec.stdio.stderr === 'pipe'\n    let completed = hasPipeOutput ? await settlement : undefined\n    while (true) {\n      const rawStatus = (await sandbox.files.read(this.paths.status)).trim()\n      if (rawStatus.length > 0) {\n        const exitCode = Number(rawStatus)\n        if (!/^(?:0|[1-9][0-9]*)$/.test(rawStatus) || !Number.isSafeInteger(exitCode) || exitCode > 255) {\n          throw new Error(`subprocess-e2b: remote wrapper published invalid exit code ${JSON.stringify(rawStatus)}`)\n        }\n        if (completed !== undefined) return this.commandOutcome(completed, exitCode)\n        const drained = await withinMs(settlement, this.spec.graceMs)\n        if (drained !== undefined) return this.commandOutcome(drained, exitCode)\n        this.outputDrainExpired = true\n        this.stdoutReader?.invalidateSpill()\n        this.stderrReader?.invalidateSpill()\n        // Release inherited-output waits so a callback blocked on host\n        // backpressure cannot keep the disconnected SDK settlement pending.\n        this.outputReleased.abort(new Error('subprocess-e2b: output drain grace expired'))\n        await handle.disconnect()\n        return { exitCode, signal: null }\n      }\n      if (completed !== undefined) return this.commandOutcome(completed)\n      // TODO(e2b-status-watch): Replace collect/inherit control-plane polling\n      // when E2B can observe direct-command exit independently of descendant-held output.\n      completed = await Promise.race([settlement, waitTick(this.pollMs).then(() => undefined)])\n    }","sourceCodeStart":509,"sourceCodeEnd":545,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/e2b/subprocess-e2b/src/process.ts#L509-L545","documentation":"Error \"subprocess-e2b: remote wrapper published invalid exit code ${JSON.stringify(rawStatus)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/e2b/subprocess-e2b/src/process.ts:527 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"}