twentyhq/twenty · error · Error
Failed to align the all campaigns view columns for workspace
Error message
Failed to align the all campaigns view columns for workspace ${workspaceId} What it means
Thrown by the 2.25 command that aligns all campaigns view column positions with the standard layout. The command computes position updates via computeViewFieldPositionsAlignedToStandard, splits them into two batches (others and lowest — the lowest-position update runs separately to avoid position conflicts), and calls validateBuildAndRunLegacyWorkspaceMigration for each batch with viewField update operations. If either batch fails, the result is logged to logger.error and the generic error is thrown.
Source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-workspace-command-1785332560000-align-message-campaign-view-field-positions.command.ts:185
isSystemBuild: true,
workspaceId,
applicationUniversalIdentifier,
allFlatEntityOperationByMetadataName: {
viewField: {
flatEntityToCreate: [],
flatEntityToDelete: [],
flatEntityToUpdate: viewFieldsToUpdate,
},
},
},
);
if (result.status === 'fail') {
this.logger.error(
`Failed to align the all campaigns view columns:\n${JSON.stringify(result, null, 2)}`,
);
throw new Error(
`Failed to align the all campaigns view columns for workspace ${workspaceId}`,
);
}
}
}
View on GitHub (pinned to 1f5dd2bbd2)
Solutions
- Read the logger.error JSON output for the specific failure report
- Flush flatViewMaps and flatViewFieldMaps from workspace cache and retry — the command is idempotent
- Verify the label identifier view field would remain at the lowest position after the update
- Run with --dryRun to inspect the planned position changes
Defensive patterns
Strategy: retry
Validate before calling
// Before running, flush view and view field cache
await workspaceCacheService.invalidateAndRecompute(workspaceId, [
'flatViewMaps',
'flatViewFieldMaps',
]);
// Confirm the all campaigns view exists
const { flatViewMaps } = await workspaceCacheService.getOrRecompute(workspaceId, [
'flatViewMaps',
]);
if (!isDefined(flatViewMaps.byUniversalIdentifier[ALL_CAMPAIGNS_VIEW_UID])) {
console.log('All campaigns view does not exist — command will skip');
} Try / catch
// Retry once after flushing cache — the command is idempotent
// Note: the command splits updates into two batches (others, lowest)
try {
await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
} catch (error) {
if (error.message.includes('Failed to align the all campaigns view columns')) {
await workspaceCacheService.flush(workspaceId, ['flatViewMaps', 'flatViewFieldMaps']);
await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
} else {
throw error;
}
} Prevention
- Run with --dryRun first to inspect the planned position changes
- Flush flatViewMaps and flatViewFieldMaps cache before retrying
- Parse the logger.error JSON for the specific viewField position validation failure
- Verify the label identifier view field remains at the strictly-lowest position after alignment
When it happens
Trigger: validateBuildAndRunLegacyWorkspaceMigration returns status 'fail' when updating viewField positions. Caused by: position validation rejecting the new values (e.g., the label identifier must remain strictly first), a viewField universal identifier not existing in the workspace, stale flatViewFieldMaps cache, or a DB error.
Common situations: The computed positions don't satisfy the validator's ordering constraints (particularly the label-identifier-must-be-first rule); a prior run partially updated positions leaving gaps or conflicts; cache is stale.
Related errors
- Failed to align the message campaign record page for workspa
- Failed to configure message campaign command menu for worksp
- Standard application is missing the messageCampaign name vie
- Failed to add the messageCampaign name field for workspace $
- Failed to remove the Campaigns navigation menu item for work
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/a7b239f031e07773.
Report an issue: GitHub.