{"record":{"id":"fdf04b35c053f3aa","repo":"deepseek-ai/deepseek-harness","slug":"gettemppathw-failed-win32-win32code-required","errorCode":null,"errorMessage":"GetTempPathW failed (Win32 ${win32Code}): required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written","messagePattern":"GetTempPathW failed \\(Win32 (.+?)\\): required (.+?) chars exceed the (.+?)-char buffer; nothing was written","errorType":"exception","errorClass":"Win32Error","httpStatus":null,"severity":"error","filePath":"packages/sandbox/sandbox-windows-acl/src/ffi.ts","lineNumber":484,"sourceCode":"  if (length === 0) return ''\n  return buffer.subarray(0, length * 2).toString('utf16le').trim()\n}\n\n/**\n * Read the process temp directory via GetTempPathW (fileapi.h line ~188).\n * Defensive against an overlong system temp path: GetTempPathW reports the\n * REQUIRED length (including NUL) without writing the buffer when it is too\n * small, so a reported length beyond the buffer's capacity means the buffer\n * was never filled and must not be decoded.\n * @param api - the binding table.\n * @returns the NUL-terminated temp path decoded as a string.\n */\nexport function getTempPath(api: Win32Bindings): string {\n  const buffer = Buffer.alloc((abi.MAX_PATH + 1) * 2)\n  const length = api.getTempPathW(buffer.length / 2, buffer)\n  if (length === 0) throwLastError(api, 'GetTempPathW')\n  if (length > buffer.length / 2) {\n    throw new Win32Error('GetTempPathW', abi.ERROR_INSUFFICIENT_BUFFER, `required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written`)\n  }\n  return buffer.subarray(0, length * 2).toString('utf16le')\n}\n\n/**\n * Throw a Win32Error for a BOOL-style API failure. MUST be called immediately\n * after the failed call so GetLastError is not clobbered by other Win32 calls.\n * @param api - the binding table.\n * @param name - the failed API's name for the error message.\n * @param detail - optional detail overriding the formatted system message.\n * @returns never — always throws.\n */\nexport function throwLastError(api: Win32Bindings, name: string, detail?: string): never {\n  const win32Code = api.getLastError()\n  throw new Win32Error(name, win32Code, detail ?? errorText(api, win32Code))\n}\n\n/**","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/sandbox/sandbox-windows-acl/src/ffi.ts#L466-L502","documentation":"Error \"GetTempPathW failed (Win32 ${win32Code}): required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/sandbox/sandbox-windows-acl/src/ffi.ts:484 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Allocate a temp-path buffer of at least the required char count and retry GetTempPathW.","Use a dynamically sized buffer instead of the fixed default."],"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"}