twentyhq/twenty · error · Error
Failed to add REPLY_TO option to messageParticipant role fie
Error message
Failed to add REPLY_TO option to messageParticipant role field for workspace ${workspaceId} What it means
Thrown by the 2.17 command that adds the REPLY_TO option to the messageParticipant.role SELECT field when validateBuildAndRunLegacyWorkspaceMigration returns status 'fail'. The logger.error above prints the full result; the thrown error is workspace-scoped. The payload updates the role field's options array to include REPLY_TO.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-17/2-17-workspace-command-1801000001000-add-reply-to-message-participant-role-option.command.ts:84
const validateAndBuildResult =
await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
{
isSystemBuild: true,
workspaceId,
applicationUniversalIdentifier:
twentyStandardFlatApplication.universalIdentifier,
allFlatEntityOperationByMetadataName: {
fieldMetadata: fieldMetadataOperations,
},
},
);
if (validateAndBuildResult.status === 'fail') {
this.logger.error(
`Failed to add REPLY_TO option to messageParticipant role field:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
);
throw new Error(
`Failed to add REPLY_TO option to messageParticipant role field for workspace ${workspaceId}`,
);
}
this.logger.log(
`Successfully added REPLY_TO option to messageParticipant role field for workspace ${workspaceId}`,
);
}
}
View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Read the logger.error JSON to find the failing option and error code.
- Inspect core.fieldMetadata for the messageParticipant role field; dedupe or repair its options array.
- Ensure the role field type is SELECT and that no other migration is editing it concurrently.
- Re-run the workspace upgrade.
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the messageParticipant role field is SELECT and does not already
// contain a conflicting REPLY_TO option.
const role = await dataSource.query(`
SELECT "type", "options" FROM core."fieldMetadata"
WHERE "nameSingular" = 'role'
AND "objectMetadataId" = (SELECT id FROM core."objectMetadata" WHERE "nameSingular" = 'messageParticipant')
`);
if (role[0]?.type !== 'SELECT') throw new Error('role field is not SELECT');
const hasReplyTo = role[0]?.options?.some((o: any) => o.value === 'REPLY_TO');
if (hasReplyTo) throw new Error('REPLY_TO already present; reconcile before upgrade'); Type guard
function isFailResult(r: unknown): r is { status: 'fail' } {
return typeof r === 'object' && r !== null && (r as any).status === 'fail';
} Try / catch
try {
const res = await service.validateBuildAndRunLegacyWorkspaceMigration(payload);
if (res.status === 'fail') throw new Error(`... for workspace ${workspaceId}`);
} catch (err) { upgradeAudit.record(workspaceId, command.id, err); throw err; } Prevention
- Dedupe SELECT option values before upgrade.
- Never change a standard field's type manually.
- Run upgrades with API mutations paused.
When it happens
Trigger: Running the 2.17 upgrade where the messageParticipant role field is not a SELECT, already contains REPLY_TO in a form that conflicts with the new option (duplicate value/color/label), or has options missing required keys the validator expects.
Common situations: Custom edit of the role field options; prior partial run that added REPLY_TO without required keys; standard seed drift; concurrent migration runs.
Related errors
- Failed to sync CallRecording status metadata for workspace $
- Migration failed for workspace ${workspaceId} while healing
- Failed to create CallRecording recordingRequestStatus metada
- Failed to delete CalendarEvent recordingPreference field for
- Failed to create CalendarEvent record page metadata for work
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/2086b41c3d4a2632.
Report an issue: GitHub.