{"record":{"id":"bd7f8811e23e0df3","repo":"different-ai/openwork","slug":"openwork-connect-mcp-metadata-is-invalid","errorCode":null,"errorMessage":"OpenWork Connect MCP metadata is invalid.","messagePattern":"OpenWork Connect MCP metadata is invalid\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/connections/store.ts","lineNumber":754,"sourceCode":"\n    const slug = entry.id ?? getMcpServerName(entry);\n    const action = snapshot.mcpServers.some((server) => server.name === slug) ? \"updated\" : \"added\";\n\n    if (conflictsWithOpenworkConnect(entry)) {\n      const error = t(\"mcp.name_reserved_openwork_connect\");\n      setStateField(\"mcpStatus\", error);\n      finishPerf(options.developerMode(), \"mcp.connect\", \"blocked\", startedAt, {\n        reason: \"openwork-connect-name-reserved\",\n      });\n      return { ok: false, error };\n    }\n\n    try {\n      mutateState((current) => ({ ...current, mcpStatus: null, mcpConnectingName: entry.name }));\n\n      if (entry.managedBy === \"openwork-connect\") {\n        if (slug !== CLOUD_MCP_SERVER_NAME) {\n          throw new Error(\"OpenWork Connect MCP metadata is invalid.\");\n        }\n        if (!canUseOpenworkServer || !openworkClient || !openworkWorkspaceId) {\n          throw new Error(\"OpenWork server is required to repair agent access to connected services.\");\n        }\n        const context = await resolveCloudMcpOperationContext(entry.url);\n        if (!context) {\n          throw new Error(\"Sign in to OpenWork Cloud and choose an organization first.\");\n        }\n        clearCloudMcpDisabledIntent(context);\n        const result = await runOpenworkCloudMcpReconciler({\n          mode: \"repair\",\n          client: openworkClient,\n          context: { ...context, trigger: \"desktop-explicit-connect\" },\n          mintToken: mintCloudControlMcpToken,\n          force: true,\n          refreshMarginMs: CLOUD_MCP_REFRESH_MARGIN_MS,\n        });\n        await refreshMcpServers();","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/connections/store.ts#L736-L772","documentation":"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.'","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the entry so its slug equals CLOUD_MCP_SERVER_NAME (remove/re-add the OpenWork Connect entry)","Delete the corrupt entry from the MCP config and reconnect the service so it is recreated with correct metadata","Check for migrations/config-sync code that may have renamed the slug","Update to a version where the canonical CLOUD_MCP_SERVER_NAME matches the persisted entry"],"exampleFix":"// before (bad persisted entry)\n{ \"slug\": \"openwork-connect-copy\", \"managedBy\": \"openwork-connect\", ... }\n// after\n{ \"slug\": CLOUD_MCP_SERVER_NAME, \"managedBy\": \"openwork-connect\", ... }","handlingStrategy":"validation","validationCode":"if (entry.managedBy === \"openwork-connect\" && entry.slug !== CLOUD_MCP_SERVER_NAME) {\n  repairOrRemoveEntry(entry); // delete corrupt entry, re-add via normal flow\n  return;\n}","typeGuard":"function isValidConnectEntry(e: McpEntry): boolean {\n  return e.managedBy !== \"openwork-connect\" || e.slug === CLOUD_MCP_SERVER_NAME;\n}","tryCatchPattern":"try {\n  await connectionsStore.connect(entry);\n} catch (err) {\n  if (err.message === \"OpenWork Connect MCP metadata is invalid.\") {\n    await removeAndReconnectEntry(entry);\n  } else throw err;\n}","preventionTips":["Never hand-edit the slug of openwork-connect managed entries","Re-add managed entries through the app instead of editing config files","Check migrations/sync code for slug renames between versions","Validate persisted MCP entries on load and drop malformed managed entries"],"tags":["mcp","metadata","validation","openwork-connect"],"backgroundTag":"invalid-mcp-metadata","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}