different-ai/openwork · error · RemoteMcpAppError

app_revision_not_found

app_revision_not_found

Error message

The active app revision was not found.

What it means

After confirming the app has an activeVersionId, refreshRemoteMcpApp queries ConfigObjectVersionTable for that exact version scoped to the app and not soft-deleted. If the row is gone (hard delete, purge, or isDeletedVersion flip), the baseline revision no longer exists and it throws 404 app_revision_not_found.

Source

Thrown at ee/apps/den-api/src/remote-mcp-apps.ts:513

  const app = await getAppRow(input.context, input.configObjectId)
  const role = await resolvePluginArchResourceRole({ context: input.context, resourceId: app.configObjectId, resourceKind: "config_object" })
  if (!role) throw new RemoteMcpAppError(404, "remote_app_not_found", "Remote MCP App not found.")
  return serializeApp(app, role)
}

export async function refreshRemoteMcpApp(input: {
  context: PluginArchActorContext
  configObjectId: string
  sourceUrl?: string
}) {
  const app = await getAppRow(input.context, input.configObjectId, "editor")
  if (!app.activeVersionId) throw new RemoteMcpAppError(409, "app_has_no_active_revision", "Activate an app revision before caching an update.")
  const activeVersions = await db.select().from(ConfigObjectVersionTable).where(and(
    eq(ConfigObjectVersionTable.configObjectId, app.configObjectId),
    eq(ConfigObjectVersionTable.id, app.activeVersionId),
    eq(ConfigObjectVersionTable.isDeletedVersion, false),
  )).limit(1)
  if (!activeVersions[0]) throw new RemoteMcpAppError(404, "app_revision_not_found", "The active app revision was not found.")
  const fetched = await fetchRemoteMcpApp(input.sourceUrl ?? app.sourceUrl)
  await createConfigObjectVersion({
    context: input.context,
    configObjectId: app.configObjectId,
    reason: fetched.digest,
    value: {
      normalizedPayloadJson: payloadForFetchedApp(fetched) as unknown as Record<string, unknown>,
      rawSourceText: fetched.html,
      schemaVersion: REMOTE_MCP_APP_CONFIG_SCHEMA_VERSION,
    },
  })
  const updatedAt = new Date()
  await db.update(RemoteMcpAppTable).set({
    sourceUrl: fetched.sourceUrl,
    resolvedSourceUrl: fetched.resolvedSourceUrl,
    updatedAt,
  }).where(eq(RemoteMcpAppTable.configObjectId, app.configObjectId))
  const updated = { ...app, sourceUrl: fetched.sourceUrl, resolvedSourceUrl: fetched.resolvedSourceUrl, updatedAt }

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Activate an existing, non-deleted revision via activateRemoteMcpAppRevision to repair activeVersionId.
  2. Re-import the app (importRemoteMcpApp) if all its revisions were purged.
  3. Check config-object version cleanup jobs for deletes that should be blocked for versions referenced by RemoteMcpAppTable.activeVersionId.
Defensive patterns

Strategy: try-catch

Try / catch

try { await refreshRemoteMcpApp({ context, configObjectId }) } catch (e) {
  if (e instanceof RemoteMcpAppError && e.code === 'app_revision_not_found') {
    // active revision is dangling: activate an existing revision or re-import the app
  }
}

Prevention

When it happens

Trigger: Calling refreshRemoteMcpApp when the active version row is missing: the version was soft-deleted (isDeletedVersion=true), hard-deleted by cleanup, or activeVersionId points at a version from a different/rolled-back config object.

Common situations: Version GC/purge jobs removing old revisions while an app still references one; database restore pointing activeVersionId at a lost row; data migration leaving dangling references.

Related errors


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