{"record":{"id":"7866c9caefa0d10b","repo":"twentyhq/twenty","slug":"failed-to-rename-conflicting-custom-fields-for-wor","errorCode":null,"errorMessage":"Failed to rename conflicting custom fields for workspace ${workspaceId}","messagePattern":"Failed to rename conflicting custom fields 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-1799000045000-rename-conflicting-custom-fields.command.ts","lineNumber":186,"sourceCode":"            allFlatEntityOperationByMetadataName: {\n              fieldMetadata: {\n                flatEntityToCreate: [],\n                flatEntityToDelete: [],\n                flatEntityToUpdate,\n              },\n            },\n            workspaceId,\n            isSystemBuild: true,\n            applicationUniversalIdentifier,\n          },\n        );\n\n      if (validateAndBuildResult.status === 'fail') {\n        this.logger.error(\n          `Failed to rename conflicting custom fields:\\n${JSON.stringify(validateAndBuildResult, null, 2)}`,\n        );\n\n        throw new Error(\n          `Failed to rename conflicting custom fields for workspace ${workspaceId}`,\n        );\n      }\n    }\n\n    this.logger.log(\n      `Renamed ${fieldsToRename.length} conflicting custom field(s) for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":168,"sourceCodeEnd":197,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-10/2-10-workspace-command-1799000045000-rename-conflicting-custom-fields.command.ts#L168-L197","documentation":"Thrown by the 2.10 workspace upgrade command when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while renaming a pre-existing custom field whose name collides with a new generic standard field (Company.annualRevenue). Renames run per-application with isSystemBuild:true; a failure aborts the whole workspace batch.","triggerScenarios":"Running the 2.10 conflicting-field rename on a workspace that has a custom 'annualRevenue' field on Company, but the computed replacement name (annualRevenueCustom / annualRevenueCustom2 ...) itself collides, or the field metadata update is rejected by the builder.","commonSituations":"Workspace already has fields named annualRevenueCustom, annualRevenueCustom2, etc. consuming candidates; the conflicting field is non-custom (the command warns and skips, but a stale cache can misclassify); rename target violates field-name validation rules.","solutions":["Read the logged validateAndBuildResult JSON to see which rename was rejected and why.","Check the Company object in the failing workspace for existing 'annualRevenueCustom*' names blocking the computed candidate.","Recompute the workspace cache and re-run so the taken-name set is accurate.","Run --dryRun to preview the computed new names before committing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Dry-run to preview computed rename names, and confirm no 'annualRevenueCustom*' names already block candidates:\nawait workspaceCacheService.invalidate(workspaceId);\nconst { flatFieldMetadataMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatFieldMetadataMaps']);\nconst companyFields = Object.values(flatFieldMetadataMaps.byUniversalIdentifier).filter((f) => isDefined(f) && f.objectMetadataUniversalIdentifier === STANDARD_OBJECTS.company.universalIdentifier);\nconst blocking = companyFields.filter((f) => /^annualRevenueCustom\\d*$/.test(f.name));\nif (blocking.length > 0) throw new Error(`Existing names block rename: ${blocking.map((f) => f.name).join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (err) {\n  logger.error(`Conflicting custom field rename failed for workspace ${workspaceId}`, err);\n  failedWorkspaces.push(workspaceId);\n}","preventionTips":["Run --dryRun to preview the computed new field names.","Check the Company object for pre-existing 'annualRevenueCustom*' names that consume candidates.","Recompute the cache so the taken-name set is accurate.","Catch per-workspace at the runner."],"tags":["migration","workspace-upgrade","field-metadata","rename","name-collision"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}