twentyhq/twenty · critical · Error

Standard application is missing messageCampaign view column

Error message

Standard application is missing messageCampaign view column ${universalIdentifier}

What it means

Thrown by the 2.20 add-message-campaign-stat-fields command when a messageCampaign view-column universal identifier (from the missing-view-field list) is not found in the standard application's flatViewFieldMaps via findFlatEntityByUniversalIdentifier. The command builds viewFieldsToCreate from the standard's view-field definitions; absence means the standard seed does not contain those view columns.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-20/2-20-workspace-command-1783525261000-add-message-campaign-stat-fields.command.ts:137

    });

    const viewsToCreate = this.resolveViewsToCreate({
      flatViewMaps,
      standardAllFlatEntityMaps,
    });

    const viewFieldsToCreate = CAMPAIGN_VIEW_FIELD_UNIVERSAL_IDENTIFIERS.filter(
      (universalIdentifier) =>
        !isDefined(flatViewFieldMaps.byUniversalIdentifier[universalIdentifier]),
    ).flatMap((universalIdentifier) => {
      const standardViewField =
        findFlatEntityByUniversalIdentifier<FlatViewField>({
          flatEntityMaps: standardAllFlatEntityMaps.flatViewFieldMaps,
          universalIdentifier,
        });

      if (!isDefined(standardViewField)) {
        throw new Error(
          `Standard application is missing messageCampaign view column ${universalIdentifier}`,
        );
      }

      const fieldUniversalIdentifier =
        standardAllFlatEntityMaps.flatFieldMetadataMaps.universalIdentifierById[
          standardViewField.fieldMetadataId
        ];

      if (!isDefined(fieldUniversalIdentifier)) {
        return [];
      }

      // The standard column list keeps growing after 2.20, so skip columns whose
      // field a later command introduces and backfills.
      const isFieldAvailable =
        isDefined(
          flatFieldMetadataMaps.byUniversalIdentifier[fieldUniversalIdentifier],

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Confirm the standard seed defines the missing messageCampaign view-column universal identifiers (grep the seed).
  2. Rebuild and redeploy the image with the matching view-column seed.
  3. Verify the standard application loads correctly.
  4. Re-run the upgrade after redeployment.
Defensive patterns

Strategy: validation

Validate before calling

// Preflight: confirm the standard seed defines all messageCampaign view columns.
const missing = CAMPAIGN_VIEW_FIELD_UNIVERSAL_IDENTIFIERS.filter(
  (id) => !isDefined(standardAllFlatEntityMaps.flatViewFieldMaps.byUniversalIdentifier[id]),
);
if (missing.length) {
  throw new Error(`Image standard seed lacks messageCampaign view columns: ${missing.join(', ')}; rebuild and redeploy.`);
}

Type guard

import { isDefined } from '@twenty/shared';

function standardDefinesAllViewFields(
  maps: { byUniversalIdentifier: Record<string, unknown> },
  ids: string[],
): boolean {
  return ids.every((id) => isDefined(maps.byUniversalIdentifier[id]));
}

Prevention

When it happens

Trigger: Running the 2.20 upgrade from an image whose standard seed predates or omits the messageCampaign view columns the command expects. Note this runs after the field check (134), so the fields exist but the view-column definitions are missing.

Common situations: Code+seed mismatch where the field seed was updated but the view-column seed was not; partial deployment; loading the wrong standard application.

Related errors


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