twentyhq/twenty · critical · Error

Standard application is missing messageCampaign field ${univ

Error message

Standard application is missing messageCampaign field ${universalIdentifier}

What it means

Thrown by the 2.20 add-message-campaign-stat-fields command when a messageCampaign field universal identifier (from the missing-identifiers list) is not found in the bundled standard application's flatFieldMetadataMaps via findFlatEntityByUniversalIdentifier. This is a standard-seed failure: the command expects the standard to define these stat fields, but they are absent.

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:113

        now: new Date().toISOString(),
        workspaceId,
        twentyStandardApplicationId: twentyStandardFlatApplication.id,
      });

    const fieldsToCreate = STAT_FIELD_UNIVERSAL_IDENTIFIERS.filter(
      (universalIdentifier) =>
        !isDefined(
          flatFieldMetadataMaps.byUniversalIdentifier[universalIdentifier],
        ),
    ).map((universalIdentifier) => {
      const standardField =
        findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({
          flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,
          universalIdentifier,
        });

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

      return standardField;
    });

    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>({

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Confirm the deployed image's standard seed defines all the messageCampaign stat field universal identifiers the command expects (grep the seed source for each).
  2. Rebuild and redeploy the image from a commit containing both the command and its seed definitions.
  3. Verify the standard application loads correctly (check load logs).
  4. Re-run the upgrade after redeployment.
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

function standardDefinesAll(
  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 metadata seed predates or omits the messageCampaign stat field definitions the command provisions. Cherry-picking the command without its seed update, or loading the wrong standard application.

Common situations: Code+seed version mismatch; build that excluded the seed module; partial deployment of the upgrade.

Related errors


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