twentyhq/twenty · error · Error

Failed to rename CallRecording name collision for workspace

Error message

Failed to rename CallRecording name collision for workspace ${workspaceId}: ${JSON.stringify(renameResult, null, 2)}

What it means

Thrown by the 2.10 CallRecording sync command when an individual rename migration (object or field collision rename) returns status 'fail'. Renames are committed one-per-migration before the create, because a combined create+rename trips the namePlural unique index. The full renameResult JSON is embedded in the message itself, not just logged.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-10/2-10-workspace-command-1799000055000-sync-call-recording-standard-objects.command.ts:518

    // Collisions can belong to different applications, so each rename runs as
    // its own migration scoped to the colliding entity's application.
    for (const {
      applicationUniversalIdentifier,
      allFlatEntityOperationByMetadataName,
    } of collisionRenameMigrations) {
      const renameResult =
        await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
          {
            isSystemBuild: true,
            applicationUniversalIdentifier,
            workspaceId,
            allFlatEntityOperationByMetadataName,
          },
        );

      if (renameResult.status === 'fail') {
        throw new Error(
          `Failed to rename CallRecording name collision for workspace ${workspaceId}: ${JSON.stringify(
            renameResult,
            null,
            2,
          )}`,
        );
      }
    }

    const validateAndBuildResult =
      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
        {
          isSystemBuild: true,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
          workspaceId,
          allFlatEntityOperationByMetadataName,
        },

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Parse the renameResult JSON embedded in the error message for the exact rejection.
  2. Recompute the workspace cache so the collision detection and rename targets are accurate, then re-run.
  3. Run --dryRun first; it logs planned object/field rename counts without committing.
  4. If a specific object/field blocks the rename, manually reconcile or delete it in the failing workspace.
Defensive patterns

Strategy: validation

Validate before calling

// Dry-run logs planned rename counts; confirm collision detection sees the same objects:
await workspaceCacheService.invalidate(workspaceId);
const { flatObjectMetadataMaps, flatFieldMetadataMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatObjectMetadataMaps', 'flatFieldMetadataMaps']);
const objectCollisions = findCallRecordingObjectNameCollisions(flatObjectMetadataMaps);
const fieldCollisions = findCalendarEventFieldNameCollisionsForCallRecording(flatFieldMetadataMaps);
if (objectCollisions.length + fieldCollisions.length === 0) {
  logger.log('No collisions detected; rename step will be skipped');
}

Try / catch

// Parse the embedded renameResult JSON from the message to decide retry vs escalate:
try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (err) {
  const match = /Failed to rename CallRecording name collision[\s\S]*?(\{[\s\S]*\})/.exec(err.message);
  const result = match ? JSON.parse(match[1]) : null;
  logger.error(`CallRecording rename failed for workspace ${workspaceId}`, result ?? err);
  failedWorkspaces.push(workspaceId);
}

Prevention

When it happens

Trigger: Running the 2.10 CallRecording sync on a workspace with a colliding callRecording/callRecordings object or calendarEvent field whose rename migration the builder rejects (e.g. target name still collides, or the object/field is referenced elsewhere blocking rename).

Common situations: Workspace has many manually-created callRecordingOld* names exhausting candidates used by the rename; stale cache so the collision set is wrong; the colliding entity is referenced by relations/views that block the rename.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/fc9be0de4273934a. Report an issue: GitHub.