different-ai/openwork · error · Error

OpenWork server is unavailable. Reconnect the server before

Error message

OpenWork server is unavailable. Reconnect the server before exporting workspace config.

What it means

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.

Source

Thrown at apps/app/src/react-app/shell/settings-route.tsx:2311

    if (!path || !isDesktopRuntime()) return;
    await revealDesktopItemInDir(path).catch(() => undefined);
  }, [workspaces]);

  const handleExportWorkspaceConfig = useCallback(async (workspaceId: string) => {
    const workspace = workspaces.find((item) => item.id === workspaceId) ?? null;
    if (!workspace) return;
    const endpoint = workspaceServerClientResolver(workspace);
    if (endpoint) {
      setExportWorkspaceBusy(true);
      try {
        const payload = await endpoint.client.exportWorkspace(endpoint.workspaceId);
        downloadWorkspaceJson(workspaceExportFilename(workspace), payload);
      } finally {
        setExportWorkspaceBusy(false);
      }
      return;
    }
    throw new Error("OpenWork server is unavailable. Reconnect the server before exporting workspace config.");
  }, [workspaceServerClientResolver, workspaces]);

  const handleForgetWorkspace = useCallback(async (workspaceId: string) => {
    if (typeof window !== "undefined") {
      const message = t("workspace_list.remove_confirm") || "Remove this workspace from the sidebar?";
      if (!window.confirm(message)) return;
    }
    if (openworkClient) {
      await openworkClient.deleteWorkspace(workspaceId).catch(() => undefined);
    }
    if (isDesktopRuntime()) {
      await workspaceForget(workspaceId).catch(() => undefined);
    }
    if (selectedWorkspaceId === workspaceId) {
      const nextWorkspace = workspaces.find((workspace) => workspace.id !== workspaceId);
      const nextId = nextWorkspace?.id ?? "";
      setLegacySelectedWorkspaceId(nextId);
      if (nextId) {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Reconnect or restart the OpenWork server, then retry the export.
  2. Verify the server client is initialized (check auth/token) so client export calls succeed.
  3. If the workspace is local, use the desktop app's download path instead of the web route.

Example fix

// before
throw new Error("OpenWork server is unavailable. Reconnect the server before exporting workspace config.");
// after
if (!openworkClient) { await reconnectServer(); }
const payload = await openworkClient.exportWorkspace(workspace.id);
downloadWorkspaceJson(workspaceExportFilename(workspace), payload);
Defensive patterns

Strategy: try-catch

Validate before calling

const canExport = Boolean(isDesktopRuntime() || openworkClient);
if (!canExport) { await reconnectServer(); }

Type guard

function isExportClient(c: unknown): c is { exportWorkspace: (id: string) => Promise<unknown> } {
  return typeof c === "object" && c !== null && "exportWorkspace" in c;
}

Try / catch

try {
  await exportWorkspaceConfig(workspace);
} catch (e) {
  if (e instanceof Error && e.message.includes("Reconnect the server before exporting")) {
    await reconnectServer().then(() => retryExport(workspace));
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Exporting from the web UI with server disconnected; expired/rotated server token causing client calls to fail; server stopped mid-session.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/e73281aec559dfd8. Report an issue: GitHub.