{"record":{"id":"849818ef86e40562","repo":"twentyhq/twenty","slug":"failed-to-create-calendarevent-record-page-metadat","errorCode":null,"errorMessage":"Failed to create CalendarEvent record page metadata for workspace ${workspaceId}: ${JSON.stringify(validateAndBuildResult, null, 2)}","messagePattern":"Failed to create CalendarEvent record page metadata for workspace (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-15/2-15-workspace-command-1800000002000-sync-calendar-event-record-page.command.ts","lineNumber":283,"sourceCode":"              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n            pageLayoutTab: {\n              flatEntityToCreate: pageLayoutTabsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n            pageLayoutWidget: {\n              flatEntityToCreate: pageLayoutWidgetsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n          },\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      throw new Error(\n        `Failed to create CalendarEvent record page metadata for workspace ${workspaceId}: ${JSON.stringify(\n          validateAndBuildResult,\n          null,\n          2,\n        )}`,\n      );\n    }\n\n    this.logger.log(\n      `Created ${totalOperationCount} CalendarEvent record page metadata item(s) for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":265,"sourceCodeEnd":297,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-15/2-15-workspace-command-1800000002000-sync-calendar-event-record-page.command.ts#L265-L297","documentation":"Thrown by the 2.15 command that syncs the CalendarEvent record page (page + pageTab + pageLayout + pageLayoutWidget) when validateBuildAndRunLegacyWorkspaceMigration returns status 'fail'. The full validateAndBuildResult is JSON-stringified into the message. It signals the build rejected the page-metadata creation payload for the workspace.","triggerScenarios":"Running the 2.15 upgrade on a workspace whose CalendarEvent object or base fields do not match the standard seed (so the page layout cannot resolve fieldMetadataId references), or where a page/pageTab with the same universal identifier already exists in a state the validator treats as a conflict.","commonSituations":"Standard seed drift between image and workspace; partial prior migration that created the pageTab but not the page; custom CalendarEvent page edits conflicting with the standard definition.","solutions":["Inspect the JSON payload in the message to find the failing entity and error codes.","Confirm CalendarEvent standard object and fields are present and match the image's seed before this command.","Resolve conflicting page/pageTab rows (delete the half-created ones from a prior failed run) and re-run.","Rebuild and redeploy the server image if the page-layout seed is stale."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm CalendarEvent object and its base fields match the standard seed\n// before the record-page command runs.\nconst ev = await dataSource.query(`SELECT id FROM core.\"objectMetadata\" WHERE \"nameSingular\" = 'calendarEvent' AND \"isActive\" = true`);\nif (!ev.length) throw new Error('CalendarEvent object missing; run prerequisite migrations first');","typeGuard":"function isFailResult(r: unknown): r is { status: 'fail' } {\n  return typeof r === 'object' && r !== null && (r as any).status === 'fail';\n}","tryCatchPattern":"try {\n  const res = await service.validateBuildAndRunLegacyWorkspaceMigration(payload);\n  if (res.status === 'fail') throw new Error(`...${JSON.stringify(res, null, 2)}`);\n} catch (err) { upgradeAudit.record(workspaceId, command.id, err); throw err; }","preventionTips":["Deploy standard seed and command code together.","Clean up half-created page/pageTab rows from prior failed runs.","Run upgrade in maintenance window per workspace."],"tags":["migration","workspace-upgrade","metadata-validation","calendar-event","record-page"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}