{"record":{"id":"01274d5b38f9d42b","repo":"deepseek-ai/deepseek-harness","slug":"subprocess-e2b-remote-environment-transport-retur","errorCode":null,"errorMessage":"subprocess-e2b: remote environment transport returned invalid base64","messagePattern":"subprocess-e2b: remote environment transport returned invalid base64","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/e2b/subprocess-e2b/src/environment.ts","lineNumber":37,"sourceCode":"  return entries\n}\n\n/**\n * Read the remote environment through ASCII base64 so SDK callback chunking cannot corrupt UTF-8.\n * @param sandbox - shared E2B execution world.\n * @param signal - optional cancellation for the control-plane request.\n * @returns the complete NUL-delimited UTF-8 environment.\n */\nexport async function readRemoteEnvironment(sandbox: Sandbox, signal?: AbortSignal): Promise<string> {\n  // TODO(e2b-replace-environment): Remove this ambient probe when E2B can start\n  // a command with a replacement environment instead of merged overrides.\n  const result = await sandbox.commands.run(\n    'set -o pipefail; dsh_e2b_passwd=\"$(getent passwd \"$(id -u)\")\"; IFS=: read -r _ _ _ _ _ dsh_e2b_home _ <<<\"$dsh_e2b_passwd\"; test -n \"$dsh_e2b_home\" -a -d \"$dsh_e2b_home\"; printf \\'%s\\' \"$dsh_e2b_home\" | base64 -w 0; printf \\'\\\\n\\'; env -0 | base64 -w 0',\n    { envs: e2bControlEnvs(), ...(signal === undefined ? {} : { signal }) },\n  )\n  const lines = result.stdout.trim().split('\\n')\n  if (lines.length !== 2 || !lines.every(line => BASE64.test(line))) {\n    throw new Error('subprocess-e2b: remote environment transport returned invalid base64')\n  }\n  const [encodedHome, encodedEnvironment] = lines as [string, string]\n  let home: string\n  let raw: string\n  try {\n    const decoder = new TextDecoder('utf-8', { fatal: true })\n    home = decoder.decode(Buffer.from(encodedHome, 'base64'))\n    raw = decoder.decode(Buffer.from(encodedEnvironment, 'base64'))\n  } catch (error: unknown) {\n    throw new Error('subprocess-e2b: remote environment is not valid UTF-8', { cause: error })\n  }\n  if (!posix.isAbsolute(home) || home.includes('\\0')) {\n    throw new Error(`subprocess-e2b: remote login home is invalid: ${JSON.stringify(home)}`)\n  }\n  const environment = new Map(remoteEnvironmentEntries(raw))\n  environment.set('HOME', home)\n  return [...environment].map(([name, value]) => `${name}=${value}\\0`).join('')\n}","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/e2b/subprocess-e2b/src/environment.ts#L19-L55","documentation":"Error \"subprocess-e2b: remote environment transport returned invalid base64\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/e2b/subprocess-e2b/src/environment.ts:37 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"}