twentyhq/twenty · error · Error
Failed to delete record page layout entities for workspace
Error message
Failed to delete record page layout entities for workspace ${workspaceId} What it means
Thrown inside the 1.23 record-page-layout backfill command's delete step when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while deleting existing record page layout entities. The full result JSON is logged before throwing to surface the deletion rejection.
Solutions
- Read the logged result JSON to see which delete operation was rejected and why.
- Recompute the workspace cache and retry so the layout entity set is current.
- Run --dryRun to inspect the planned delete set.
- Manually reconcile dangling references in the failing workspace before re-running.
Defensive patterns
Strategy: validation
Validate before calling
// Dry-run to inspect the planned delete set, and confirm no dangling references block deletion:
await workspaceCacheService.invalidate(workspaceId);
const { flatRecordPageLayoutMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatRecordPageLayoutMaps']);
const referenced = await checkLayoutReferences(workspaceId, flatRecordPageLayoutMaps);
if (referenced.length > 0) throw new Error('Some layouts still referenced; cannot delete safely'); Try / catch
try {
await command.runOnWorkspace({ workspaceId, options });
} catch (err) {
logger.error(`Record page layout delete failed for workspace ${workspaceId}`, err);
failedWorkspaces.push(workspaceId);
} Prevention
- Run --dryRun to review the delete set.
- Recompute the cache before running so the delete set is accurate.
- Check for views/sections still referencing layouts before deleting.
- Isolate per-workspace failures at the runner.
When it happens
Trigger: Running the 1.23 backfill on a workspace whose record-page-layout entities are referenced by other metadata the validator won't let cascade-delete, or where the delete batch references identifiers absent from the workspace.
Common situations: Layout entities still referenced by views/sections blocking deletion; stale cache so the delete set is wrong; a previous partial run left orphaned references.
Related errors
- Failed to create custom object page layouts for workspace
- Failed to create standard record page layouts for workspace
- CallRecording status metadata is not a SELECT field for…
- Failed to add jobTitle field on workspaceMember for…
- Failed to add messageCampaign stat fields for workspace
AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12).
Data as JSON: /api/errors/77e0073654342e27.
Report an issue: GitHub.
Appendix: source
Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/1-23/1-23-workspace-command-1780000001500-backfill-record-page-layouts.command.ts:230
flatEntityToUpdate: [],
},
pageLayout: {
flatEntityToCreate: [],
flatEntityToDelete: recordPageLayouts,
flatEntityToUpdate: [],
},
},
workspaceId,
applicationUniversalIdentifier:
twentyStandardFlatApplication.universalIdentifier,
},
);
if (result.status === 'fail') {
this.logger.error(
`Failed to delete record page layout entities:\n${JSON.stringify(result, null, 2)}`,
);
throw new Error(
`Failed to delete record page layout entities for workspace ${workspaceId}`,
);
}
}
private async createStandardRecordPageLayouts({
workspaceId,
twentyStandardFlatApplication,
}: {
workspaceId: string;
twentyStandardFlatApplication: FlatApplication;
}): Promise<void> {
const standardMaps =
computeTwentyStandardApplicationAllFlatEntityMapsPre231({
now: new Date().toISOString(),
workspaceId,
twentyStandardApplicationId: twentyStandardFlatApplication.id,
});View on GitHub (pinned to 1f5dd2bbd2)