{"record":{"id":"fc490e73ea1728f3","repo":"deepseek-ai/deepseek-harness","slug":"createprocessasuserw-succeeded-but-returned-null-p","errorCode":null,"errorMessage":"CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})","messagePattern":"CreateProcessAsUserW succeeded but returned null process/thread handles \\(pid (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/sandbox/sandbox-windows-acl/src/spawn.ts","lineNumber":150,"sourceCode":"  // Capture the failure before CloseHandle calls clobber GetLastError, then\n  // close every pipe handle created so far — the six-close contract this test\n  // surface pins (tests/failure-paths.spec.ts).\n  if (created === 0) {\n    const win32Code = api.getLastError()\n    api.closeHandle(stdIn.read)\n    api.closeHandle(stdIn.write)\n    api.closeHandle(stdOut.read)\n    api.closeHandle(stdOut.write)\n    api.closeHandle(stdErr.read)\n    api.closeHandle(stdErr.write)\n    throwWin32(api, 'CreateProcessAsUserW', win32Code, `command: ${options.command}, cwd: ${options.cwd}`)\n  }\n\n  const info = decodeProcessInfo(processInfo)\n  const processHandle = info.hProcess\n  const threadHandle = info.hThread\n  if (processHandle === null || threadHandle === null) {\n    throw new Error(`CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})`)\n  }\n\n  // Host-side cleanup: child handles are now duplicated in the child; the\n  // host closes its copies so ReadFile sees EOF when the child exits.\n  api.closeHandle(stdIn.read)\n  api.closeHandle(stdOut.write)\n  api.closeHandle(stdErr.write)\n  api.closeHandle(stdIn.write)\n  api.closeHandle(threadHandle)\n\n  return {\n    pid: info.dwProcessId,\n    process: processHandle,\n    stdoutRead: stdOut.read,\n    stderrRead: stdErr.read,\n  }\n}\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sandbox/sandbox-windows-acl/src/spawn.ts#L132-L168","documentation":"Error \"CreateProcessAsUserW succeeded but returned null process/thread handles (pid ${info.dwProcessId})\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sandbox/sandbox-windows-acl/src/spawn.ts:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat this as a Win32 API inconsistency: retry the spawn, and if it persists, check for security software interfering with CreateProcessAsUserW handle returns."],"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"}