{"record":{"id":"c0aa11e36f900bb0","repo":"musistudio/claude-code-router","slug":"window-is-unavailable","errorCode":null,"errorMessage":"Window is unavailable.","messagePattern":"Window is unavailable\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/electron/src/main/ipc.ts","lineNumber":488,"sourceCode":"    },\n    config,\n    exportedAt,\n    files: readDataExportFiles(),\n    kind: \"claude-code-router-data-export\",\n    version: 1\n  };\n\n  writeFileSync(result.filePath, `${JSON.stringify(payload, null, 2)}\\n`, { encoding: \"utf8\", mode: 0o600 });\n  return {\n    canceled: false,\n    exportedAt,\n    file: result.filePath\n  };\n}\n\nasync function captureElementPng(window: BrowserWindow | null, request: AppCaptureElementPngRequest): Promise<AppCaptureElementPngResult> {\n  if (!window) {\n    throw new Error(\"Window is unavailable.\");\n  }\n\n  const rect = sanitizeCaptureRect(request.rect);\n  const result = await imageExportFile(window, request.fileName, request.exportId);\n  if (result.canceled || !result.filePath) {\n    return { canceled: true };\n  }\n\n  const image = await window.webContents.capturePage(rect);\n  const png = image.toPNG();\n  writeFileSync(result.filePath, pngWithExportProcessing(png, request, rect.width), { mode: 0o600 });\n  return { canceled: false, file: result.filePath };\n}\n\nasync function renderHtmlPng(window: BrowserWindow | null, request: AppRenderHtmlPngRequest): Promise<AppRenderHtmlPngResult> {\n  const html = typeof request.html === \"string\" ? request.html : \"\";\n  if (!html.trim()) {\n    throw new Error(\"Export HTML is empty.\");","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/electron/src/main/ipc.ts#L470-L506","documentation":"Error \"Window is unavailable.\" thrown in musistudio/claude-code-router.","triggerScenarios":"Thrown at packages/electron/src/main/ipc.ts:488 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":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}