{"record":{"id":"0d604b9f330f59d0","repo":"twentyhq/twenty","slug":"failed-to-create-messagelist-view-for-workspace","errorCode":null,"errorMessage":"Failed to create messageList view for workspace ${workspaceId}","messagePattern":"Failed to create messageList view for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-20/2-20-workspace-command-1783525261001-create-message-list-view.command.ts","lineNumber":151,"sourceCode":"              flatEntityToCreate: viewsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n            viewField: {\n              flatEntityToCreate: viewFieldsToCreate,\n              flatEntityToDelete: [],\n              flatEntityToUpdate: [],\n            },\n          },\n        },\n      );\n\n    if (result.status === 'fail') {\n      this.logger.error(\n        `Failed to create messageList view:\\n${JSON.stringify(result, null, 2)}`,\n      );\n\n      throw new Error(\n        `Failed to create messageList view for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(`Created messageList view for workspace ${workspaceId}`);\n  }\n\n  private resolveViewsToCreate({\n    flatViewMaps,\n    standardAllFlatEntityMaps,\n  }: {\n    flatViewMaps: WorkspaceCacheDataMap['flatViewMaps'];\n    standardAllFlatEntityMaps: TwentyStandardAllFlatEntityMaps;\n  }): FlatView[] {\n    if (\n      isDefined(\n        flatViewMaps.byUniversalIdentifier[LIST_VIEW_UNIVERSAL_IDENTIFIER],\n      )","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-20/2-20-workspace-command-1783525261001-create-message-list-view.command.ts#L133-L169","documentation":"Thrown by the 2.20 create-message-list-view command when result.status === 'fail' after attempting to create the messageList view and its view fields for the workspace. The logger.error above prints the full result. Standard seed checks (138) have passed, so this is a per-workspace build-phase rejection.","triggerScenarios":"Running the 2.20 upgrade on a workspace where a messageList view or its view fields already exist in a conflicting state, where the Message object is missing/inconsistent, or where the create payload fails schema validation.","commonSituations":"Workspace with a pre-existing messageList view that conflicts; prior partial run leaving half-created rows; Message object drifted from standard; concurrent migrations.","solutions":["Read the logger.error JSON to find the failing entity and error code.","Inspect the view and viewField metadata tables for existing messageList rows that conflict; remove or reconcile.","Confirm the Message object exists and matches the standard seed.","Re-run the workspace upgrade."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm no conflicting messageList view/rows already exist.\nconst existing = await dataSource.query(`\n  SELECT id FROM core.\"view\" WHERE \"nameSingular\" = 'messageList' OR \"universalIdentifier\" = $1\n`, [LIST_VIEW_UNIVERSAL_IDENTIFIER]);\nif (existing.length) throw new Error('messageList view already exists; reconcile before upgrade');","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(`... for workspace ${workspaceId}`);\n} catch (err) { upgradeAudit.record(workspaceId, command.id, err); throw err; }","preventionTips":["Detect pre-existing views/viewFields sharing standard universal identifiers before upgrade.","Clean up half-created rows from prior failed runs.","Run upgrades with API mutations paused."],"tags":["migration","workspace-upgrade","metadata-validation","view","message-list"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}