{"record":{"id":"256f14b06b8d94cf","repo":"different-ai/openwork","slug":"app-import-incomplete","errorCode":"app_import_incomplete","errorMessage":"The immutable app revision was not created.","messagePattern":"The immutable app revision was not created\\.","errorType":"http","errorClass":"RemoteMcpAppError","httpStatus":422,"severity":"error","filePath":"ee/apps/den-api/src/remote-mcp-apps.ts","lineNumber":476,"sourceCode":"      description: fetched.metadata.description,\n      sourceRepositoryUrl: fetched.sourceUrl.length <= 1024 ? fetched.sourceUrl : null,\n    })\n    pluginId = normalizeDenTypeId(\"plugin\", plugin.id)\n  }\n  const configObject = await createConfigObject({\n    context: input.context,\n    objectType: \"app\",\n    pluginIds: [pluginId],\n    requireFreshSession: input.requireFreshSession,\n    sourceMode: \"import\",\n    value: {\n      normalizedPayloadJson: payloadForFetchedApp(fetched) as unknown as Record<string, unknown>,\n      rawSourceText: fetched.html,\n      schemaVersion: REMOTE_MCP_APP_CONFIG_SCHEMA_VERSION,\n    },\n  })\n  const versionId = configObject.latestVersion?.id\n  if (!versionId) throw new RemoteMcpAppError(422, \"app_import_incomplete\", \"The immutable app revision was not created.\")\n  const now = new Date()\n  const app: RemoteMcpAppRow = {\n    configObjectId: normalizeDenTypeId(\"configObject\", configObject.id),\n    organizationId: input.context.organizationContext.organization.id,\n    pluginId,\n    activeVersionId: input.activate === false ? null : normalizeDenTypeId(\"configObjectVersion\", versionId),\n    sourceUrl: fetched.sourceUrl,\n    resolvedSourceUrl: fetched.resolvedSourceUrl,\n    status: \"active\",\n    createdAt: now,\n    updatedAt: now,\n    retiredAt: null,\n  }\n  await db.insert(RemoteMcpAppTable).values(app)\n  return serializeApp(app, \"manager\")\n}\n\nexport async function getRemoteMcpApp(input: { context: PluginArchActorContext; configObjectId: string }) {","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/remote-mcp-apps.ts#L458-L494","documentation":"importRemoteMcpApp downloads a remote MCP app, creates a plugin, a config object, and an initial immutable config-object version. If createConfigObject returns without a latestVersion.id, the code cannot record an immutable revision to activate, so it throws 422 app_import_incomplete before inserting the RemoteMcpAppTable row. It guards against importing an app that has no persisted revision behind it.","triggerScenarios":"Calling importRemoteMcpApp where createConfigObject (objectType 'app', sourceMode 'import') succeeds but configObject.latestVersion?.id is undefined — e.g. the config-object service created the object but did not materialize an initial version for the provided normalizedPayloadJson/rawSourceText payload.","commonSituations":"Importing a remote MCP app from a URL whose payload the version-writing path silently skipped; a backend/regression where createConfigObject stops returning latestVersion; partial transactional failure between object creation and version creation.","solutions":["Verify createConfigObject is returning an object that includes latestVersion.id for sourceMode 'import'; check the config-object service logs for failed version writes.","Retry the import with a fresh call to importRemoteMcpApp; no app row is inserted when this throws, so retrying is safe.","Confirm the fetched payload (payloadForFetchedApp output, rawSourceText, schemaVersion) passes config-object validation so the initial version is materialized.","If it persists, upgrade/patch the den-api config-object service so an 'app' object always gets an initial version."],"exampleFix":"// no caller code change; ensure import payload is valid\nawait importRemoteMcpApp({ context, sourceUrl, pluginId, activate: true })\n// on 422, retry after fixing the server-side version materialization","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await importRemoteMcpApp(input) } catch (e) {\n  if (e instanceof RemoteMcpAppError && e.code === 'app_import_incomplete') {\n    // no app row was inserted; safe to retry after checking server version-write health\n  }\n}","preventionTips":["Keep den-api and config-object service versions in sync so latestVersion is always returned","Validate the remote app source URL/payload before import","Retry imports idempotently — this error leaves no partial app row"],"tags":["server","config-object","import","http-422"],"backgroundTag":"import-incomplete","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}