{"record":{"id":"18275827a1fcd1b3","repo":"twentyhq/twenty","slug":"failed-to-create-custom-object-page-layouts-for-wo","errorCode":null,"errorMessage":"Failed to create custom object page layouts for workspace ${workspaceId}","messagePattern":"Failed to create custom object page layouts for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/1-23/1-23-workspace-command-1780000001500-backfill-record-page-layouts.command.ts","lineNumber":591,"sourceCode":"              flatEntityToUpdate: [],\n            },\n            viewField: {\n              flatEntityToCreate: allViewFields,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n          },\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (result.status === 'fail') {\n      this.logger.error(\n        `Failed to create custom object page layouts:\\n${JSON.stringify(result, null, 2)}`,\n      );\n      throw new Error(\n        `Failed to create custom object page layouts for workspace ${workspaceId}`,\n      );\n    }\n  }\n}\n","sourceCodeStart":573,"sourceCodeEnd":597,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/1-23/1-23-workspace-command-1780000001500-backfill-record-page-layouts.command.ts#L573-L597","documentation":"Thrown inside the 1.23 backfill command's custom-object-layout create step when validateBuildAndRunLegacyWorkspaceMigration returns 'fail' while creating page layouts for custom objects. The result JSON is logged first; this is the final step of the command so the throw ends the workspace run.","triggerScenarios":"Running the 1.23 backfill on a workspace whose custom objects are missing from cache or whose layout batch duplicates existing custom-object layouts the validator rejects.","commonSituations":"Stale cache missing custom objects; partial prior run created some custom layouts already; custom object referenced by the layout was deleted mid-upgrade.","solutions":["Read the logged result JSON for the precise rejection.","Recompute the workspace cache and retry.","Run --dryRun to inspect planned custom-object layouts.","Reconcile any deleted custom objects in the failing workspace."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Dry-run to preview custom-object layouts, and confirm custom objects exist in cache:\nawait workspaceCacheService.invalidate(workspaceId);\nconst { flatObjectMetadataMaps } = await workspaceCacheService.getOrRecompute(workspaceId, ['flatObjectMetadataMaps']);\nconst customObjects = Object.values(flatObjectMetadataMaps.byUniversalIdentifier).filter((o) => isDefined(o) && o.isCustom);\nif (customObjects.length === 0) throw new Error('No custom objects found; nothing to create layouts for');","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (err) {\n  logger.error(`Custom object page layout create failed for workspace ${workspaceId}`, err);\n  failedWorkspaces.push(workspaceId);\n}","preventionTips":["Run --dryRun to confirm planned custom-object layouts.","Recompute the cache so custom objects resolve.","Reconcile any deleted custom objects before running.","Catch per-workspace at the runner."],"tags":["migration","workspace-upgrade","record-page-layout","custom-objects"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}