different-ai/openwork · error

OpenWork Connect MCP metadata is invalid.

Error message

OpenWork Connect MCP metadata is invalid.

What it means

In createConnectionsStore's connect/repair path, when an MCP entry is managedBy 'openwork-connect', the slug must equal CLOUD_MCP_SERVER_NAME (the canonical OpenWork Connect server name). If the entry's slug differs, its metadata is corrupt or hand-edited, and the store throws 'OpenWork Connect MCP metadata is invalid.'

Source

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

    const slug = entry.id ?? getMcpServerName(entry);
    const action = snapshot.mcpServers.some((server) => server.name === slug) ? "updated" : "added";

    if (conflictsWithOpenworkConnect(entry)) {
      const error = t("mcp.name_reserved_openwork_connect");
      setStateField("mcpStatus", error);
      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();

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Fix the entry so its slug equals CLOUD_MCP_SERVER_NAME (remove/re-add the OpenWork Connect entry)
  2. Delete the corrupt entry from the MCP config and reconnect the service so it is recreated with correct metadata
  3. Check for migrations/config-sync code that may have renamed the slug
  4. Update to a version where the canonical CLOUD_MCP_SERVER_NAME matches the persisted entry

Example fix

// before (bad persisted entry)
{ "slug": "openwork-connect-copy", "managedBy": "openwork-connect", ... }
// after
{ "slug": CLOUD_MCP_SERVER_NAME, "managedBy": "openwork-connect", ... }
Defensive patterns

Strategy: validation

Validate before calling

if (entry.managedBy === "openwork-connect" && entry.slug !== CLOUD_MCP_SERVER_NAME) {
  repairOrRemoveEntry(entry); // delete corrupt entry, re-add via normal flow
  return;
}

Type guard

function isValidConnectEntry(e: McpEntry): boolean {
  return e.managedBy !== "openwork-connect" || e.slug === CLOUD_MCP_SERVER_NAME;
}

Try / catch

try {
  await connectionsStore.connect(entry);
} catch (err) {
  if (err.message === "OpenWork Connect MCP metadata is invalid.") {
    await removeAndReconnectEntry(entry);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the store's connect action for an entry with managedBy === 'openwork-connect' whose slug is anything other than CLOUD_MCP_SERVER_NAME — e.g. an entry imported/renamed incorrectly or persisted with stale metadata.

Common situations: Manually editing the MCP config and duplicating the cloud server under a different slug; a migration or sync bug writing wrong slugs; restoring an old config where the canonical name changed between versions.

Related errors


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