deepseek-ai/deepseek-harness · error · Win32Error
GetTempPathW failed (Win32 ${win32Code}): required ${length}
Error message
GetTempPathW failed (Win32 ${win32Code}): required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written What it means
Error "GetTempPathW failed (Win32 ${win32Code}): required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written" thrown in deepseek-ai/deepseek-harness.
Source
Thrown at packages/sandbox/sandbox-windows-acl/src/ffi.ts:484
if (length === 0) return ''
return buffer.subarray(0, length * 2).toString('utf16le').trim()
}
/**
* Read the process temp directory via GetTempPathW (fileapi.h line ~188).
* Defensive against an overlong system temp path: GetTempPathW reports the
* REQUIRED length (including NUL) without writing the buffer when it is too
* small, so a reported length beyond the buffer's capacity means the buffer
* was never filled and must not be decoded.
* @param api - the binding table.
* @returns the NUL-terminated temp path decoded as a string.
*/
export function getTempPath(api: Win32Bindings): string {
const buffer = Buffer.alloc((abi.MAX_PATH + 1) * 2)
const length = api.getTempPathW(buffer.length / 2, buffer)
if (length === 0) throwLastError(api, 'GetTempPathW')
if (length > buffer.length / 2) {
throw new Win32Error('GetTempPathW', abi.ERROR_INSUFFICIENT_BUFFER, `required ${length} chars exceed the ${buffer.length / 2}-char buffer; nothing was written`)
}
return buffer.subarray(0, length * 2).toString('utf16le')
}
/**
* Throw a Win32Error for a BOOL-style API failure. MUST be called immediately
* after the failed call so GetLastError is not clobbered by other Win32 calls.
* @param api - the binding table.
* @param name - the failed API's name for the error message.
* @param detail - optional detail overriding the formatted system message.
* @returns never — always throws.
*/
export function throwLastError(api: Win32Bindings, name: string, detail?: string): never {
const win32Code = api.getLastError()
throw new Win32Error(name, win32Code, detail ?? errorText(api, win32Code))
}
/**View on GitHub (pinned to b150a551b8)
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.
When it happens
Trigger: Thrown at packages/sandbox/sandbox-windows-acl/src/ffi.ts:484 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/fdf04b35c053f3aa.
Report an issue: GitHub.