{"record":{"id":"b38968a88befe7a8","repo":"twentyhq/twenty","slug":"failed-to-configure-message-campaign-command-menu","errorCode":null,"errorMessage":"Failed to configure message campaign command menu for workspace ${workspaceId}: ${JSON.stringify(validateAndBuildResult, null, 2)}","messagePattern":"Failed to configure message campaign command menu for workspace (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-workspace-command-1785229960000-configure-message-campaign-command-menu.command.ts","lineNumber":169,"sourceCode":"    const validateAndBuildResult =\n      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(\n        {\n          isSystemBuild: true,\n          allFlatEntityOperationByMetadataName: {\n            commandMenuItem: {\n              flatEntityToCreate: itemsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: itemsToUpdate,\n            },\n          },\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      throw new Error(\n        `Failed to configure message campaign command menu for workspace ${workspaceId}: ${JSON.stringify(\n          validateAndBuildResult,\n          null,\n          2,\n        )}`,\n      );\n    }\n\n    this.logger.log(\n      `Configured message campaign command menu for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":151,"sourceCodeEnd":183,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-workspace-command-1785229960000-configure-message-campaign-command-menu.command.ts#L151-L183","documentation":"Thrown by the 2.25 command that adds Send Campaign / Send Test Email record actions and hides favorite/navigation actions on the message campaign record page. After computing commandMenuItem create and update operations, the command calls validateBuildAndRunLegacyWorkspaceMigration. If the pipeline fails, the error is thrown WITH the full validateAndBuildResult JSON inlined in the message.","triggerScenarios":"validateBuildAndRunLegacyWorkspaceMigration returns status 'fail' when creating/updating commandMenuItem flat entities for the message campaign. Caused by: the standard command menu items (sendMessageCampaign, sendMessageCampaignTest) not existing in standard definitions, the message campaign page layout not existing (guarded by early return), stale flatCommandMenuItemMaps cache, or a DB error.","commonSituations":"Standard command menu items were renamed or removed in twenty-shared; the workspace's command menu items are in an inconsistent state from a prior partial upgrade; cache is stale.","solutions":["The thrown error message contains JSON.stringify(validateAndBuildResult, null, 2) — parse it for the specific failure report","Flush flatCommandMenuItemMaps and flatPageLayoutMaps from workspace cache and retry","Verify STANDARD_COMMAND_MENU_ITEMS.sendMessageCampaign and sendMessageCampaignTest exist in standard definitions","Run with --dryRun to inspect the operations"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before running, flush command menu item and page layout cache\nawait workspaceCacheService.invalidateAndRecompute(workspaceId, [\n  'flatCommandMenuItemMaps',\n  'flatPageLayoutMaps',\n]);\n\n// Confirm the message campaign page layout exists\nconst { flatPageLayoutMaps } = await workspaceCacheService.getOrRecompute(workspaceId, [\n  'flatPageLayoutMaps',\n]);\n\nif (!isDefined(flatPageLayoutMaps.byUniversalIdentifier[CAMPAIGN_PAGE_LAYOUT_UID])) {\n  console.log('Message campaign page layout does not exist — command will skip');\n}","typeGuard":null,"tryCatchPattern":"// The thrown error includes the full JSON — parse for retryable failures\ntry {\n  await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });\n} catch (error) {\n  if (error.message.includes('Failed to configure message campaign command menu')) {\n    await workspaceCacheService.flush(workspaceId, ['flatCommandMenuItemMaps', 'flatPageLayoutMaps']);\n    await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });\n  } else {\n    throw error;\n  }\n}","preventionTips":["The thrown error message embeds JSON.stringify(validateAndBuildResult) — parse it for the exact failure report","Verify STANDARD_COMMAND_MENU_ITEMS.sendMessageCampaign and sendMessageCampaignTest exist in standard definitions","Run with --dryRun first to inspect the command menu item operations","Flush flatCommandMenuItemMaps cache before retrying"],"tags":["metadata","upgrade-command","workspace-migration","validate-build-run","command-menu-item","message-campaign"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}