twentyhq/twenty · error · Error
Failed to configure message campaign command menu for worksp
Error message
Failed to configure message campaign command menu for workspace ${workspaceId}: ${JSON.stringify(validateAndBuildResult, null, 2)} What it means
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.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-workspace-command-1785229960000-configure-message-campaign-command-menu.command.ts:169
const validateAndBuildResult =
await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
{
isSystemBuild: true,
allFlatEntityOperationByMetadataName: {
commandMenuItem: {
flatEntityToCreate: itemsToCreate,
flatEntityToDelete: [],
flatEntityToUpdate: itemsToUpdate,
},
},
workspaceId,
applicationUniversalIdentifier:
twentyStandardFlatApplication.universalIdentifier,
},
);
if (validateAndBuildResult.status === 'fail') {
throw new Error(
`Failed to configure message campaign command menu for workspace ${workspaceId}: ${JSON.stringify(
validateAndBuildResult,
null,
2,
)}`,
);
}
this.logger.log(
`Configured message campaign command menu for workspace ${workspaceId}`,
);
}
}
View on GitHub (pinned to 1f5dd2bbd2)
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
Defensive patterns
Strategy: retry
Validate before calling
// Before running, flush command menu item and page layout cache
await workspaceCacheService.invalidateAndRecompute(workspaceId, [
'flatCommandMenuItemMaps',
'flatPageLayoutMaps',
]);
// Confirm the message campaign page layout exists
const { flatPageLayoutMaps } = await workspaceCacheService.getOrRecompute(workspaceId, [
'flatPageLayoutMaps',
]);
if (!isDefined(flatPageLayoutMaps.byUniversalIdentifier[CAMPAIGN_PAGE_LAYOUT_UID])) {
console.log('Message campaign page layout does not exist — command will skip');
} Try / catch
// The thrown error includes the full JSON — parse for retryable failures
try {
await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
} catch (error) {
if (error.message.includes('Failed to configure message campaign command menu')) {
await workspaceCacheService.flush(workspaceId, ['flatCommandMenuItemMaps', 'flatPageLayoutMaps']);
await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
} else {
throw error;
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to fix "Go to Roles Settings" command menu item path
- Failed to align the message campaign record page for workspa
- Failed to add the messageCampaign name field for workspace $
- Failed to remove the Campaigns navigation menu item for work
- Failed to align the all campaigns view columns for workspace
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/b38968a88befe7a8.
Report an issue: GitHub.