{"record":{"id":"b9ed0a0b9523f611","repo":"twentyhq/twenty","slug":"standard-application-is-missing-messagecampaign-fi","errorCode":null,"errorMessage":"Standard application is missing messageCampaign field ${universalIdentifier}","messagePattern":"Standard application is missing messageCampaign field (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-20/2-20-workspace-command-1783525261000-add-message-campaign-stat-fields.command.ts","lineNumber":113,"sourceCode":"        now: new Date().toISOString(),\n        workspaceId,\n        twentyStandardApplicationId: twentyStandardFlatApplication.id,\n      });\n\n    const fieldsToCreate = STAT_FIELD_UNIVERSAL_IDENTIFIERS.filter(\n      (universalIdentifier) =>\n        !isDefined(\n          flatFieldMetadataMaps.byUniversalIdentifier[universalIdentifier],\n        ),\n    ).map((universalIdentifier) => {\n      const standardField =\n        findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({\n          flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,\n          universalIdentifier,\n        });\n\n      if (!isDefined(standardField)) {\n        throw new Error(\n          `Standard application is missing messageCampaign field ${universalIdentifier}`,\n        );\n      }\n\n      return standardField;\n    });\n\n    const viewsToCreate = this.resolveViewsToCreate({\n      flatViewMaps,\n      standardAllFlatEntityMaps,\n    });\n\n    const viewFieldsToCreate = CAMPAIGN_VIEW_FIELD_UNIVERSAL_IDENTIFIERS.filter(\n      (universalIdentifier) =>\n        !isDefined(flatViewFieldMaps.byUniversalIdentifier[universalIdentifier]),\n    ).flatMap((universalIdentifier) => {\n      const standardViewField =\n        findFlatEntityByUniversalIdentifier<FlatViewField>({","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-20/2-20-workspace-command-1783525261000-add-message-campaign-stat-fields.command.ts#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"Code+seed version mismatch; build that excluded the seed module; partial deployment of the upgrade.","solutions":["Confirm the deployed image's standard seed defines all the messageCampaign stat field universal identifiers the command expects (grep the seed source for each).","Rebuild and redeploy the image from a commit containing both the command and its seed definitions.","Verify the standard application loads correctly (check load logs).","Re-run the upgrade after redeployment."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Preflight: confirm the standard seed defines all messageCampaign stat field IDs.\nconst missing = CAMPAIGN_FIELD_UNIVERSAL_IDENTIFIERS.filter(\n  (id) => !isDefined(standardAllFlatEntityMaps.flatFieldMetadataMaps.byUniversalIdentifier[id]),\n);\nif (missing.length) {\n  throw new Error(`Image standard seed lacks messageCampaign fields: ${missing.join(', ')}; rebuild and redeploy.`);\n}","typeGuard":"import { isDefined } from '@twenty/shared';\n\nfunction standardDefinesAll(\n  maps: { byUniversalIdentifier: Record<string, unknown> },\n  ids: string[],\n): boolean {\n  return ids.every((id) => isDefined(maps.byUniversalIdentifier[id]));\n}","tryCatchPattern":null,"preventionTips":["Always build the image from a single commit so command + seed ship together.","Add a preflight that asserts every command's referenced standard identifiers exist before running upgrades.","Never cherry-pick a command file without its seed update."],"tags":["migration","workspace-upgrade","standard-seed","missing-metadata","code-image-mismatch","message-campaign"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}