twentyhq/twenty · error · Error
Could not find an available ${originalFieldName}Old name aft
Error message
Could not find an available ${originalFieldName}Old name after ${MAX_OLD_NAME_ATTEMPTS} attempts What it means
Thrown by resolveAvailableOldCalendarEventFieldName after 100 candidate field names (<name>Old, <name>Old2 ... <name>Old101) are all taken among calendarEvent fields plus the additional reserved set. MAX_OLD_NAME_ATTEMPTS is 100.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-10/utils/call-recording-name-collision.util.ts:167
.filter(
(flatFieldMetadata) =>
flatFieldMetadata.objectMetadataUniversalIdentifier ===
STANDARD_OBJECTS.calendarEvent.universalIdentifier,
)
.map((flatFieldMetadata) => flatFieldMetadata.name),
...additionalTakenNames,
]);
for (let attempt = 0; attempt < MAX_OLD_NAME_ATTEMPTS; attempt++) {
const discriminator = attempt === 0 ? '' : `${attempt + 1}`;
const candidateName = `${originalFieldName}${FIELD_OLD_NAME_SUFFIX}${discriminator}`;
if (!takenFieldNames.has(candidateName)) {
return candidateName;
}
}
throw new Error(
`Could not find an available ${originalFieldName}Old name after ${MAX_OLD_NAME_ATTEMPTS} attempts`,
);
};
export const buildCalendarEventFieldRenameUpdates = ({
flatFieldMetadataMaps,
now,
}: {
flatFieldMetadataMaps: FlatEntityMaps<FlatFieldMetadata>;
now: string;
}): FlatFieldMetadata[] => {
const reservedOldFieldNames = new Set<string>();
return findCalendarEventFieldNameCollisionsForCallRecording(
flatFieldMetadataMaps,
).map((collidingFieldMetadata) => {
const name = resolveAvailableOldCalendarEventFieldName({
flatFieldMetadataMaps,View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Query calendarEvent fields matching /^<originalFieldName>Old\d*$/ in the failing workspace and remove the surplus.
- Re-run the command once names are freed.
- As a last resort, raise MAX_OLD_NAME_ATTEMPTS in the util and re-run.
Example fix
// before: throws after 100 attempts with no prior signal
const name = resolveAvailableOldCalendarEventFieldName({ flatFieldMetadataMaps, originalFieldName });
// after: pre-check available slots
const taken = countFieldsMatching(flatFieldMetadataMaps, new RegExp(`${originalFieldName}Old\\d*`));
if (taken >= 100) {
throw new Error(`No free ${originalFieldName}Old slots; clean up duplicate calendarEvent fields first`);
} Defensive patterns
Strategy: validation
Validate before calling
import { resolveAvailableOldCalendarEventFieldName } from '../utils/call-recording-name-collision.util';
// Before calling, count existing <originalFieldName>Old* calendarEvent fields:
const pattern = new RegExp(`${originalFieldName}Old\\d*`);
const takenCount = Object.values(flatFieldMetadataMaps.byUniversalIdentifier)
.filter(isDefined)
.filter((f) => f.objectMetadataUniversalIdentifier === STANDARD_OBJECTS.calendarEvent.universalIdentifier && pattern.test(f.name))
.length;
if (takenCount >= 100) {
throw new Error(`${originalFieldName}Old namespace exhausted; remove duplicate calendarEvent fields before retrying`);
}
const name = resolveAvailableOldCalendarEventFieldName({ flatFieldMetadataMaps, originalFieldName }); Prevention
- Before running the CallRecording sync, query calendarEvent fields matching /^<originalFieldName>Old\d*$/ and clean up duplicates.
- Recompute the workspace cache so the taken-name set is accurate.
- Treat this error as a data-hygiene signal requiring cleanup, not a retryable glitch.
When it happens
Trigger: A workspace's calendarEvent object has 100+ fields covering the entire <originalFieldName>Old<number> range, leaving no free name for renaming a colliding recordingPreference/callRecordings field.
Common situations: Pathological workspace with mass duplicate calendarEvent fields; repeated aborted migrations leaving many Old-suffixed fields; extremely unlikely under normal use.
Related errors
- Could not find an available callRecordingOld name after ${MA
- Failed to rename conflicting custom fields for workspace ${w
- Failed to rename CallRecording name collision for workspace
- Failed to create inactive generic standard fields for worksp
- Failed to create CallRecording standard objects for workspac
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/dd362d807ffdfbc8.
Report an issue: GitHub.