{"record":{"id":"55b006108fe114c9","repo":"twentyhq/twenty","slug":"standard-application-is-missing-the-message-isdraf","errorCode":null,"errorMessage":"Standard application is missing the Message isDraft field metadata","messagePattern":"Standard application is missing the Message isDraft field metadata","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-18/2-18-workspace-command-1810000005000-add-message-is-draft-field.command.ts","lineNumber":96,"sourceCode":"      await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(\n        { workspaceId },\n      );\n\n    const { allFlatEntityMaps: standardAllFlatEntityMaps } =\n      computeTwentyStandardApplicationAllFlatEntityMaps({\n        now: new Date().toISOString(),\n        workspaceId,\n        twentyStandardApplicationId: twentyStandardFlatApplication.id,\n      });\n\n    const isDraftFlatFieldMetadata =\n      findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({\n        flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,\n        universalIdentifier: MESSAGE_IS_DRAFT_FIELD_UNIVERSAL_IDENTIFIER,\n      });\n\n    if (!isDefined(isDraftFlatFieldMetadata)) {\n      throw new Error(\n        'Standard application is missing the Message isDraft field metadata',\n      );\n    }\n\n    if (isDryRun) {\n      this.logger.log(\n        `[DRY RUN] Would create Message isDraft field for workspace ${workspaceId}`,\n      );\n\n      return;\n    }\n\n    const validateAndBuildResult =\n      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(\n        {\n          isSystemBuild: true,\n          allFlatEntityOperationByMetadataName: {\n            fieldMetadata: {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-18/2-18-workspace-command-1810000005000-add-message-is-draft-field.command.ts#L78-L114","documentation":"Thrown by the 2.18 command that adds the Message.isDraft field when findFlatEntityByUniversalIdentifier cannot locate MESSAGE_IS_DRAFT_FIELD_UNIVERSAL_IDENTIFIER in the bundled standard application's flatFieldMetadataMaps. This is a seed/code-image failure, not a per-workspace data failure: the standard definition itself does not contain the field this command was written to provision.","triggerScenarios":"Running the 2.18 upgrade from an image whose standard metadata seed predates or omits the isDraft field definition, while the upgrade command (code) references it. Can also happen if standard seed loading was partial or the wrong standard application was loaded.","commonSituations":"Mismatched code+seed versions (e.g. cherry-picked the command file without its seed update); build that excluded the seed module; deploying only the migration without the matching standard-metadata package.","solutions":["Confirm the deployed image's standard application seed includes MESSAGE_IS_DRAFT_FIELD_UNIVERSAL_IDENTIFIER; grep the seed source for it.","Rebuild and redeploy the image from a commit that contains both the command and its seed definition.","Verify the standard application is being loaded correctly (check the load logs for the twentyStandard application).","Re-run the upgrade after redeployment."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Preflight: confirm the deployed image's standard seed defines the field.\nconst stdField = findFlatEntityByUniversalIdentifier<FlatFieldMetadata>({\n  flatEntityMaps: standardAllFlatEntityMaps.flatFieldMetadataMaps,\n  universalIdentifier: MESSAGE_IS_DRAFT_FIELD_UNIVERSAL_IDENTIFIER,\n});\nif (!isDefined(stdField)) {\n  throw new Error('Image standard seed lacks Message.isDraft field; rebuild and redeploy.');\n}","typeGuard":"import { isDefined } from '@twenty/shared';\n\ntype FlatFieldMetadata = { id: string; universalIdentifier?: string; type: string };\n\nfunction hasStandardField(\n  maps: { byUniversalIdentifier: Record<string, unknown> },\n  id: string,\n): boolean {\n  return isDefined(maps.byUniversalIdentifier[id]);\n}","tryCatchPattern":null,"preventionTips":["Always build the image from a single commit so the command and its seed ship together.","Add a preflight that asserts every command's referenced standard identifiers exist in the loaded seed before running upgrades.","Never cherry-pick a command file without its seed update."],"tags":["migration","workspace-upgrade","standard-seed","missing-metadata","code-image-mismatch"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}