twentyhq/twenty · critical · Error

Standard application is missing the messageCampaign name fie

Error message

Standard application is missing the messageCampaign name field

What it means

Thrown by the 2.25 command that adds the internal name field to messageCampaign. After confirming the workspace has the messageCampaign object but lacks the name field, the command looks up the standard field definition via findFlatEntityByUniversalIdentifier in the computed standard flat field metadata maps. If STANDARD_OBJECTS.messageCampaign.fields.name is absent from the standard definitions, the lookup returns undefined and the command throws.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-workspace-command-1785229970000-add-message-campaign-name-field.command.ts:114

      });

    const fieldsToCreate: FlatFieldMetadata[] = [];

    if (
      !isDefined(
        flatFieldMetadataMaps.byUniversalIdentifier[
          NAME_FIELD_UNIVERSAL_IDENTIFIER
        ],
      )
    ) {
      const standardNameField =
        findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({
          flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,
          universalIdentifier: NAME_FIELD_UNIVERSAL_IDENTIFIER,
        });

      if (!isDefined(standardNameField)) {
        throw new Error(
          'Standard application is missing the messageCampaign name field',
        );
      }

      fieldsToCreate.push(standardNameField);
    }

    // Move the label identifier from subject to name, but never clobber a
    // user customization pointing at another field.
    const currentLabelIdentifier =
      campaignObjectMetadata.labelIdentifierFieldMetadataUniversalIdentifier;
    const isNameLabelIdentifier =
      !isDefined(currentLabelIdentifier) ||
      currentLabelIdentifier === SUBJECT_FIELD_UNIVERSAL_IDENTIFIER ||
      currentLabelIdentifier === NAME_FIELD_UNIVERSAL_IDENTIFIER;
    const flatObjectMetadataToUpdate: FlatObjectMetadata[] =
      isNameLabelIdentifier &&
      currentLabelIdentifier !== NAME_FIELD_UNIVERSAL_IDENTIFIER

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Verify STANDARD_OBJECTS.messageCampaign.fields.name exists in the installed twenty-shared package
  2. Rebuild twenty-shared: npx nx build twenty-shared
  3. Ensure twenty-server and twenty-shared are at the same release tag
  4. Run with --dryRun first to confirm the standard field resolves
Defensive patterns

Strategy: validation

Validate before calling

// Before running, verify the standard field exists in the installed definitions
import { STANDARD_OBJECTS } from 'twenty-shared/metadata';

const fieldUid = STANDARD_OBJECTS.messageCampaign?.fields?.name?.universalIdentifier;

if (!fieldUid) {
  throw new Error('twenty-shared does not define messageCampaign.fields.name — rebuild twenty-shared');
}

Type guard

import { isDefined } from 'twenty-shared/utils';

const hasStandardField = (uid: string | undefined): uid is string =>
  isDefined(uid) && uid.length > 0;

Prevention

When it happens

Trigger: Running 'upgrade:2-25:add-message-campaign-name-field' when twenty-shared/metadata does not define STANDARD_OBJECTS.messageCampaign.fields.name.universalIdentifier. Caused by version skew between twenty-server and twenty-shared, or the name field was removed/renamed in a fork.

Common situations: Forked twenty-shared where messageCampaign fields were customized; running against an older twenty-shared build that predates the name field; a regression in standard definitions.

Related errors


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