{"record":{"id":"fc9be0de4273934a","repo":"twentyhq/twenty","slug":"failed-to-rename-callrecording-name-collision-for","errorCode":null,"errorMessage":"Failed to rename CallRecording name collision for workspace ${workspaceId}: ${JSON.stringify(renameResult, null, 2)}","messagePattern":"Failed to rename CallRecording name collision for workspace (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-10/2-10-workspace-command-1799000055000-sync-call-recording-standard-objects.command.ts","lineNumber":518,"sourceCode":"\n    // Collisions can belong to different applications, so each rename runs as\n    // its own migration scoped to the colliding entity's application.\n    for (const {\n      applicationUniversalIdentifier,\n      allFlatEntityOperationByMetadataName,\n    } of collisionRenameMigrations) {\n      const renameResult =\n        await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(\n          {\n            isSystemBuild: true,\n            applicationUniversalIdentifier,\n            workspaceId,\n            allFlatEntityOperationByMetadataName,\n          },\n        );\n\n      if (renameResult.status === 'fail') {\n        throw new Error(\n          `Failed to rename CallRecording name collision for workspace ${workspaceId}: ${JSON.stringify(\n            renameResult,\n            null,\n            2,\n          )}`,\n        );\n      }\n    }\n\n    const validateAndBuildResult =\n      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(\n        {\n          isSystemBuild: true,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n          workspaceId,\n          allFlatEntityOperationByMetadataName,\n        },","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-10/2-10-workspace-command-1799000055000-sync-call-recording-standard-objects.command.ts#L500-L536","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Parse the renameResult JSON embedded in the error message for the exact rejection.","Recompute the workspace cache so the collision detection and rename targets are accurate, then re-run.","Run --dryRun first; it logs planned object/field rename counts without committing.","If a specific object/field blocks the rename, manually reconcile or delete it in the failing workspace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Dry-run logs planned rename counts; confirm collision detection sees the same objects:\nawait workspaceCacheService.invalidate(workspaceId);\nconst { flatObjectMetadataMaps, flatFieldMetadataMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatObjectMetadataMaps', 'flatFieldMetadataMaps']);\nconst objectCollisions = findCallRecordingObjectNameCollisions(flatObjectMetadataMaps);\nconst fieldCollisions = findCalendarEventFieldNameCollisionsForCallRecording(flatFieldMetadataMaps);\nif (objectCollisions.length + fieldCollisions.length === 0) {\n  logger.log('No collisions detected; rename step will be skipped');\n}","typeGuard":null,"tryCatchPattern":"// Parse the embedded renameResult JSON from the message to decide retry vs escalate:\ntry {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (err) {\n  const match = /Failed to rename CallRecording name collision[\\s\\S]*?(\\{[\\s\\S]*\\})/.exec(err.message);\n  const result = match ? JSON.parse(match[1]) : null;\n  logger.error(`CallRecording rename failed for workspace ${workspaceId}`, result ?? err);\n  failedWorkspaces.push(workspaceId);\n}","preventionTips":["Run --dryRun first; it logs planned object/field rename counts without committing.","Recompute the cache so collision detection and rename targets are accurate.","If a specific object/field blocks the rename, reconcile or delete it before retrying.","Parse the embedded renameResult JSON before retrying; never retry unchanged."],"tags":["migration","workspace-upgrade","call-recording","rename","name-collision"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}