different-ai/openwork · error

Sign in to OpenWork Cloud, then try reconnecting again.

Error message

Sign in to OpenWork Cloud, then try reconnecting again.

What it means

The chat MCP reconnect flow requires Den (OpenWork Cloud) credentials: an auth token and an active organization id read from readDenSettings(). If either is missing or blank, the flow cannot authenticate to the Den API, so it opens the connect dialog (props.onOpenConnect()) and throws to abort the reconnect.

Source

Thrown at apps/app/src/react-app/domains/session/surface/session-surface.tsx:2353

    };
    window.addEventListener(denSettingsChangedEvent, resetReconnectState);
    window.addEventListener(CLOUD_INVENTORY_CHANGED_EVENT, refreshImportedPlugins);
    return () => {
      window.removeEventListener(denSettingsChangedEvent, resetReconnectState);
      window.removeEventListener(CLOUD_INVENTORY_CHANGED_EVENT, refreshImportedPlugins);
    };
  }, []);

  const handleMcpReconnect = useCallback(async (
    action: ChatToolReconnectAction,
    onProgress: (progress: ChatToolReconnectProgress) => void,
  ): Promise<ChatToolReconnectResult> => {
    const settings = readDenSettings();
    const token = settings.authToken?.trim() ?? "";
    const organizationId = settings.activeOrgId?.trim() ?? "";
    if (!token || !organizationId) {
      props.onOpenConnect();
      throw new Error("Sign in to OpenWork Cloud, then try reconnecting again.");
    }

    const scope: ChatMcpReconnectScope = {
      baseUrl: settings.baseUrl,
      token,
      organizationId,
    };
    const currentScope = (): ChatMcpReconnectScope => {
      const current = readDenSettings();
      return {
        baseUrl: current.baseUrl,
        token: current.authToken?.trim() ?? "",
        organizationId: current.activeOrgId?.trim() ?? "",
      };
    };
    try {
      const denClient = createDenClient({ baseUrl: settings.baseUrl, token });
      const connections = await denClient.listMcpConnections(organizationId, "usable");

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Sign in to OpenWork Cloud (the error already opens the connect dialog — complete the sign-in)
  2. Verify readDenSettings() returns a non-empty authToken and activeOrgId before retrying reconnect
  3. If the token exists but reconnect still fails, re-authenticate to refresh an expired token
  4. Persist/re-select an active organization in Den settings

Example fix

// before
await reconnectTool({ connectionId });
// after
const settings = readDenSettings();
if (!settings.authToken?.trim() || !settings.activeOrgId?.trim()) {
  props.onOpenConnect(); // complete sign-in, then retry
  return;
}
await reconnectTool({ connectionId });
Defensive patterns

Strategy: validation

Validate before calling

const settings = readDenSettings();
const ready = Boolean(settings.authToken?.trim() && settings.activeOrgId?.trim());
if (!ready) props.onOpenConnect();

Try / catch

try {
  await reconnect(action);
} catch (e) {
  if (e instanceof Error && e.message.includes("Sign in to OpenWork Cloud")) {
    openConnectDialog(); // user completes sign-in, then retries
  } else throw e;
}

Prevention

When it happens

Trigger: Invoking the chat tool reconnect handler when settings.authToken is empty/whitespace or settings.activeOrgId is unset — i.e. the user is not signed in to OpenWork Cloud or no organization is active.

Common situations: User signed out of Den or token expired; desktop app never connected to OpenWork Cloud; activeOrgId cleared after org switch/removal; reconnect attempted from a stale session surface after settings reset.

Related errors


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