twentyhq/twenty · error · Error

Failed to update the message campaign record page for…

Error message

Failed to update the message campaign record page for workspace ${workspaceId}: ${JSON.stringify(validateAndBuildResult, null, 2)}

What it means

Thrown by the 2.31 command that trims the message campaign record page (deletes and updates page-layout widgets). It submits the operations via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it throws with the full report embedded. The report identifies which widget delete/update failed.

Solutions

  1. Read the embedded JSON report to find the failing widget operation and error code.
  2. Reconcile missing widgets (remove orphan references) or re-seed the message campaign record page.
  3. Re-run the 2.31 command for the workspace.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
  const report = JSON.parse(e.message.split(':').slice(1).join(':').trim());
  logger.error({ workspaceId, report }, 'message campaign record page trim failed');
}

Prevention

When it happens

Trigger: A page-layout widget targeted for delete no longer exists (already removed); a widget targeted for update references a view/field that is gone; the message campaign record page layout itself is missing or was replaced by a custom one.

Common situations: A prior run partially trimmed the page; a custom message campaign layout diverged from the standard; cross-version upgrade where the base page was never seeded.

Related errors


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

Appendix: source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-31/2-31-workspace-command-1786456707000-trim-message-campaign-record-page.command.ts:159

    const validateAndBuildResult =
      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
        {
          isSystemBuild: true,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
          workspaceId,
          allFlatEntityOperationByMetadataName: {
            pageLayoutWidget: {
              flatEntityToCreate: [],
              flatEntityToDelete: pageLayoutWidgetsToDelete,
              flatEntityToUpdate: pageLayoutWidgetsToUpdate,
            },
          },
        },
      );

    if (validateAndBuildResult.status === 'fail') {
      throw new Error(
        `Failed to update the message campaign record page for workspace ${workspaceId}: ${JSON.stringify(
          validateAndBuildResult,
          null,
          2,
        )}`,
      );
    }

    this.logger.log(
      `Updated the message campaign record page for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)