{"record":{"id":"497b89533e8f0e55","repo":"deepseek-ai/deepseek-harness","slug":"what-failed-hresult-0x-hr-0-tostring-16","errorCode":null,"errorMessage":"${what} failed: HRESULT 0x${(hr >>> 0).toString(16)}","messagePattern":"(.+?) failed: HRESULT 0x(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/host/directory-picker-native/src/win32-dialog-logic.ts","lineNumber":91,"sourceCode":"   * @returns the created dialog surface; throws when creation fails.\n   */\n  createFolderDialog(): Win32FolderDialog\n  /**\n   * `GetCurrentThreadId` — the native id a driver needs to close this\n   * thread's windows from outside.\n   * @returns the calling thread's native id.\n   */\n  currentThreadId(): number\n}\n\n/**\n * Throw when an HRESULT signals failure.\n * @param hr - the HRESULT to check.\n * @param what - the failing call's name for the error message.\n * @returns the (successful) HRESULT unchanged.\n */\nfunction check(hr: number, what: string): number {\n  if (hr < 0) throw new Error(`${what} failed: HRESULT 0x${(hr >>> 0).toString(16)}`)\n  return hr\n}\n\n/**\n * Run one modal folder-picker conversation on the calling thread: DPI opt-in,\n * STA init, dialog creation, `Show`, and result extraction, releasing the\n * dialog on every path.\n * @param bindings - the native surface (koffi-backed in production, fakes in tests).\n * @param title - the dialog title text.\n * @param onShowing - called with the native thread id immediately before the\n *   blocking `Show`, so a driver on another thread can close the dialog.\n * @returns the selected filesystem path, or null when the user cancels.\n */\nexport function runFolderDialog(\n  bindings: Win32DialogBindings,\n  title: string,\n  onShowing: (threadId: number) => void,\n): string | null {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/host/directory-picker-native/src/win32-dialog-logic.ts#L73-L109","documentation":"Error \"${what} failed: HRESULT 0x${(hr >>> 0).toString(16)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/host/directory-picker-native/src/win32-dialog-logic.ts:91 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"}