deepseek-ai/deepseek-harness · error

CreateProcessAsUserW succeeded but returned null process/thr

Error message

CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})

What it means

Error "CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/sandbox/sandbox-windows-acl/src/spawn.ts:150

  // Capture the failure before CloseHandle calls clobber GetLastError, then
  // close every pipe handle created so far — the six-close contract this test
  // surface pins (tests/failure-paths.spec.ts).
  if (created === 0) {
    const win32Code = api.getLastError()
    api.closeHandle(stdIn.read)
    api.closeHandle(stdIn.write)
    api.closeHandle(stdOut.read)
    api.closeHandle(stdOut.write)
    api.closeHandle(stdErr.read)
    api.closeHandle(stdErr.write)
    throwWin32(api, 'CreateProcessAsUserW', win32Code, `command: ${options.command}, cwd: ${options.cwd}`)
  }

  const info = decodeProcessInfo(processInfo)
  const processHandle = info.hProcess
  const threadHandle = info.hThread
  if (processHandle === null || threadHandle === null) {
    throw new Error(`CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})`)
  }

  // Host-side cleanup: child handles are now duplicated in the child; the
  // host closes its copies so ReadFile sees EOF when the child exits.
  api.closeHandle(stdIn.read)
  api.closeHandle(stdOut.write)
  api.closeHandle(stdErr.write)
  api.closeHandle(stdIn.write)
  api.closeHandle(threadHandle)

  return {
    pid: info.dwProcessId,
    process: processHandle,
    stdoutRead: stdOut.read,
    stderrRead: stdErr.read,
  }
}

View on GitHub (pinned to b150a551b8)

Solutions

  1. Treat this as a Win32 API inconsistency: retry the spawn, and if it persists, check for security software interfering with CreateProcessAsUserW handle returns.

When it happens

Trigger: Thrown at packages/sandbox/sandbox-windows-acl/src/spawn.ts:150 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/fc490e73ea1728f3. Report an issue: GitHub.