twentyhq/twenty · error · Error

Failed to create standard record page layouts for workspace

Error message

Failed to create standard record page layouts for workspace ${workspaceId}

What it means

Thrown inside the 1.23 backfill command's standard-layout create step when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while creating standard record page layouts. The command logs the result JSON, then throws to abort the workspace upgrade.

Solutions

  1. Inspect the logged result JSON for the specific create rejection.
  2. Recompute the workspace cache and re-run.
  3. Run --dryRun to preview the standard layouts to create.
  4. Confirm the twenty-standard flat application for the workspace matches the build.
Defensive patterns

Strategy: validation

Validate before calling

// Dry-run to preview standard layouts to create, and confirm standard objects exist in cache:
await workspaceCacheService.invalidate(workspaceId);
const { flatObjectMetadataMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatObjectMetadataMaps']);
const missingObjects = REQUIRED_STANDARD_OBJECT_IDS.filter((id) => !isDefined(flatObjectMetadataMaps.byUniversalIdentifier[id]));
if (missingObjects.length > 0) throw new Error(`Missing standard objects: ${missingObjects.join(', ')}`);

Try / catch

try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (err) {
  logger.error(`Standard record page layout create failed for workspace ${workspaceId}`, err);
  failedWorkspaces.push(workspaceId);
}

Prevention

When it happens

Trigger: Running the 1.23 standard record page layout creation on a workspace where the referenced standard objects/sections are missing from cache, or the layout batch duplicates existing layouts the validator rejects.

Common situations: Stale workspace cache so standard objects resolve to nothing; partial prior run already created some layouts (duplicates); standard flat application version mismatch.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/6b513ca7d6933931. 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:448

              flatEntityToUpdate: [],
            },
            viewFieldGroup: {
              flatEntityToCreate: viewFieldGroups,
              flatEntityToDelete: [],
              flatEntityToUpdate: [],
            },
          },
          workspaceId,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
        },
      );

    if (result.status === 'fail') {
      this.logger.error(
        `Failed to create standard record page layouts:\n${JSON.stringify(result, null, 2)}`,
      );
      throw new Error(
        `Failed to create standard record page layouts for workspace ${workspaceId}`,
      );
    }
  }

  private async createCustomObjectPageLayouts({
    workspaceId,
    twentyStandardFlatApplication,
  }: {
    workspaceId: string;
    twentyStandardFlatApplication: FlatApplication;
  }): Promise<void> {
    const {
      flatObjectMetadataMaps,
      flatFieldMetadataMaps,
      flatPageLayoutMaps,
    } = await this.workspaceCacheService.getOrRecompute(workspaceId, [
      'flatObjectMetadataMaps',

View on GitHub (pinned to 1f5dd2bbd2)