different-ai/openwork · error

Sign in to OpenWork Cloud and choose an organization first.

Error message

Sign in to OpenWork Cloud and choose an organization first.

What it means

After the server prerequisite check, the repair path calls resolveCloudMcpOperationContext(entry.url) to obtain the Den/cloud operation context (org, auth, routing). If it returns null — the user is not authenticated to OpenWork Cloud or has not picked an organization — the store throws 'Sign in to OpenWork Cloud and choose an organization first.'

Source

Thrown at apps/app/src/react-app/domains/connections/store.ts:761

      finishPerf(options.developerMode(), "mcp.connect", "blocked", startedAt, {
        reason: "openwork-connect-name-reserved",
      });
      return { ok: false, error };
    }

    try {
      mutateState((current) => ({ ...current, mcpStatus: null, mcpConnectingName: entry.name }));

      if (entry.managedBy === "openwork-connect") {
        if (slug !== CLOUD_MCP_SERVER_NAME) {
          throw new Error("OpenWork Connect MCP metadata is invalid.");
        }
        if (!canUseOpenworkServer || !openworkClient || !openworkWorkspaceId) {
          throw new Error("OpenWork server is required to repair agent access to connected services.");
        }
        const context = await resolveCloudMcpOperationContext(entry.url);
        if (!context) {
          throw new Error("Sign in to OpenWork Cloud and choose an organization first.");
        }
        clearCloudMcpDisabledIntent(context);
        const result = await runOpenworkCloudMcpReconciler({
          mode: "repair",
          client: openworkClient,
          context: { ...context, trigger: "desktop-explicit-connect" },
          mintToken: mintCloudControlMcpToken,
          force: true,
          refreshMarginMs: CLOUD_MCP_REFRESH_MARGIN_MS,
        });
        await refreshMcpServers();
        if (result.health?.usable) {
          setStateField("mcpStatus", t("mcp.connected"));
          finishPerf(options.developerMode(), "mcp.connect", "done", startedAt, {
            name: entry.name,
            type: entryType,
            slug,
          });

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Sign in to OpenWork Cloud (Account → Sign in flow) and select an organization, then retry the repair
  2. Re-authenticate if the Den session token expired
  3. Trigger the connect action again after the sign-in completes so the context resolves
  4. Verify resolveCloudMcpOperationContext can reach the Den endpoint (network/auth configuration)

Example fix

// before
await connectionsStore.connect(entry);
// after
const ctx = await resolveCloudMcpOperationContext(entry.url);
if (!ctx) {
  await promptOpenworkCloudSignIn(); // sign in + choose org
}
await connectionsStore.connect(entry);
Defensive patterns

Strategy: try-catch

Validate before calling

const ctx = await resolveCloudMcpOperationContext(entry.url);
if (!ctx) { await promptOpenworkCloudSignIn(); return; }

Type guard

function hasCloudContext(c: CloudMcpOperationContext | null): c is CloudMcpOperationContext {
  return c != null && typeof c.orgId === "string";
}

Try / catch

try {
  await connectionsStore.connect(entry);
} catch (err) {
  if (err.message.startsWith("Sign in to OpenWork Cloud")) {
    await startCloudSignInFlow(); // re-auth + org selection, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: Repairing an openwork-connect MCP entry while the Den session is absent, expired, or has no organization selected, so resolveCloudMcpOperationContext cannot build a context for the entry URL.

Common situations: Expired OpenWork Cloud token mid-session; a fresh install where the user connected services previously but never signed in on this machine; switching Den orgs and the cached context no longer resolves.

Related errors


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