{"record":{"id":"e73281aec559dfd8","repo":"different-ai/openwork","slug":"openwork-server-is-unavailable-reconnect-the-serv-e73281","errorCode":null,"errorMessage":"OpenWork server is unavailable. Reconnect the server before exporting workspace config.","messagePattern":"OpenWork server is unavailable\\. Reconnect the server before exporting workspace config\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/shell/settings-route.tsx","lineNumber":2311,"sourceCode":"    if (!path || !isDesktopRuntime()) return;\n    await revealDesktopItemInDir(path).catch(() => undefined);\n  }, [workspaces]);\n\n  const handleExportWorkspaceConfig = useCallback(async (workspaceId: string) => {\n    const workspace = workspaces.find((item) => item.id === workspaceId) ?? null;\n    if (!workspace) return;\n    const endpoint = workspaceServerClientResolver(workspace);\n    if (endpoint) {\n      setExportWorkspaceBusy(true);\n      try {\n        const payload = await endpoint.client.exportWorkspace(endpoint.workspaceId);\n        downloadWorkspaceJson(workspaceExportFilename(workspace), payload);\n      } finally {\n        setExportWorkspaceBusy(false);\n      }\n      return;\n    }\n    throw new Error(\"OpenWork server is unavailable. Reconnect the server before exporting workspace config.\");\n  }, [workspaceServerClientResolver, workspaces]);\n\n  const handleForgetWorkspace = useCallback(async (workspaceId: string) => {\n    if (typeof window !== \"undefined\") {\n      const message = t(\"workspace_list.remove_confirm\") || \"Remove this workspace from the sidebar?\";\n      if (!window.confirm(message)) return;\n    }\n    if (openworkClient) {\n      await openworkClient.deleteWorkspace(workspaceId).catch(() => undefined);\n    }\n    if (isDesktopRuntime()) {\n      await workspaceForget(workspaceId).catch(() => undefined);\n    }\n    if (selectedWorkspaceId === workspaceId) {\n      const nextWorkspace = workspaces.find((workspace) => workspace.id !== workspaceId);\n      const nextId = nextWorkspace?.id ?? \"\";\n      setLegacySelectedWorkspaceId(nextId);\n      if (nextId) {","sourceCodeStart":2293,"sourceCodeEnd":2329,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/shell/settings-route.tsx#L2293-L2329","documentation":"Exporting workspace config needs the server to fetch the canonical config. The handler first tries desktop runtime, web client, and download-only paths; if none can produce the export payload (no reachable server/client), the final throw explains that the OpenWork server must be reconnected before exporting.","triggerScenarios":"Clicking export workspace config when isDesktopRuntime() is false, openworkClient/client is null or every client export call rejects, and the local-file fallback path is skipped — i.e., the handler reaches its end without returning.","commonSituations":"Exporting from the web UI with server disconnected; expired/rotated server token causing client calls to fail; server stopped mid-session.","solutions":["Reconnect or restart the OpenWork server, then retry the export.","Verify the server client is initialized (check auth/token) so client export calls succeed.","If the workspace is local, use the desktop app's download path instead of the web route."],"exampleFix":"// before\nthrow new Error(\"OpenWork server is unavailable. Reconnect the server before exporting workspace config.\");\n// after\nif (!openworkClient) { await reconnectServer(); }\nconst payload = await openworkClient.exportWorkspace(workspace.id);\ndownloadWorkspaceJson(workspaceExportFilename(workspace), payload);","handlingStrategy":"try-catch","validationCode":"const canExport = Boolean(isDesktopRuntime() || openworkClient);\nif (!canExport) { await reconnectServer(); }","typeGuard":"function isExportClient(c: unknown): c is { exportWorkspace: (id: string) => Promise<unknown> } {\n  return typeof c === \"object\" && c !== null && \"exportWorkspace\" in c;\n}","tryCatchPattern":"try {\n  await exportWorkspaceConfig(workspace);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"Reconnect the server before exporting\")) {\n    await reconnectServer().then(() => retryExport(workspace));\n  } else throw e;\n}","preventionTips":["Check client/server availability before rendering export buttons.","Re-authenticate when export calls fail with auth errors.","Keep desktop download fallback wired for local workspaces.","Persist and rehydrate the server handle after restarts."],"tags":["network","server-unavailable","export"],"backgroundTag":"server-unavailable","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}