{"record":{"id":"f7e82eb9acf2ba08","repo":"twentyhq/twenty","slug":"block-settings-command-menu-item-is-missing-from-t","errorCode":null,"errorMessage":"Block Settings command menu item is missing from the standard application definition","messagePattern":"Block Settings command menu item is missing from the standard application definition","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-28/2-28-workspace-command-1785921674941-add-email-block-settings-command-menu-item.command.ts","lineNumber":95,"sourceCode":"      );\n\n      return;\n    }\n\n    const { allFlatEntityMaps: standardAllFlatEntityMaps } =\n      computeTwentyStandardApplicationAllFlatEntityMaps({\n        now: new Date().toISOString(),\n        workspaceId,\n        twentyStandardApplicationId: twentyStandardFlatApplication.id,\n      });\n\n    const itemToCreate =\n      standardAllFlatEntityMaps.flatCommandMenuItemMaps.byUniversalIdentifier[\n        EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER\n      ];\n\n    if (!isDefined(itemToCreate)) {\n      throw new Error(\n        `Block Settings command menu item is missing from the standard application definition`,\n      );\n    }\n\n    this.logger.log(\n      `${isDryRun ? '[DRY RUN] ' : ''}Adding the Block Settings command menu item for workspace ${workspaceId}`,\n    );\n\n    if (isDryRun) {\n      return;\n    }\n\n    const validateAndBuildResult =\n      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(\n        {\n          isSystemBuild: true,\n          allFlatEntityOperationByMetadataName: {\n            commandMenuItem: {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-28/2-28-workspace-command-1785921674941-add-email-block-settings-command-menu-item.command.ts#L77-L113","documentation":"Thrown by the 2.28 command that adds the Block Settings (email) command menu item. It computes the standard application's flat entity maps and looks up EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER in flatCommandMenuItemMaps; if undefined, it throws. This is a code/definition defect, not a data defect: the standard application definition shipped in the running code does not contain an entry for that universal identifier, so the command cannot source the entity to create.","triggerScenarios":"The constant EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER does not match any key in the standard command-menu-item definitions (typo, renamed constant, or the definition file was not updated in the same commit as the command). Also occurs if a cherry-picked command file landed without its companion definition change.","commonSituations":"A partial merge/cherry-pick that brought the upgrade command but not the standard-application-definition edit; a constant rename in twenty-shared/application that was not propagated; running a build whose twenty-shared package was not rebuilt (stale transpiled output).","solutions":["Grep the standard application definition for EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER to confirm it is actually defined and exported.","If missing, add the command menu item to the standard definition (or correct the constant/import) so the lookup resolves.","Rebuild twenty-shared before twenty-server (npx nx build twenty-shared) so the server sees the current definitions.","Verify the universal identifier spelling matches exactly between the command and the definition map key."],"exampleFix":"// before — definition map has no entry, lookup returns undefined\n// const itemToCreate =\n//   standardAllFlatEntityMaps.flatCommandMenuItemMaps.byUniversalIdentifier[\n//     EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER  // not a key in the map\n//   ];\n\n// after — add the entry to the standard command-menu-item definitions:\n//   [EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER]: { ...FieldDefinition }\n// so the lookup resolves and the command proceeds.","handlingStrategy":"validation","validationCode":"// Assert the standard definition actually defines the item before running the command:\nconst maps = computeTwentyStandardApplicationAllFlatEntityMaps({\n  now: new Date().toISOString(), workspaceId, twentyStandardApplicationId,\n});\nif (!isDefined(maps.allFlatEntityMaps.flatCommandMenuItemMaps.byUniversalIdentifier[EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER])) {\n  throw new Error('Fix the standard definition before running the upgrade');\n}","typeGuard":"const hasStandardCommandMenuItem = (\n  maps: AllFlatEntityMaps, ui: string,\n): ui is string =>\n  isDefined(maps.flatCommandMenuItemMaps.byUniversalIdentifier[ui]);","tryCatchPattern":null,"preventionTips":["Keep the upgrade command and its standard-definition edit in the same commit.","Rebuild twenty-shared before twenty-server (npx nx build twenty-shared) so definitions are current.","Add a unit test asserting the universal identifier resolves from the standard map."],"tags":["migration","upgrade-command","standard-application","command-menu-item","code-defect","build"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}