twentyhq/twenty · error · Error

Failed to add the Block Settings command menu item for works

Error message

Failed to add the Block Settings command menu item for workspace ${workspaceId}: ${JSON.stringify(validateAndBuildResult, null, 2)}

What it means

Thrown by the same 2.28 command (add-email-block-settings-command-menu-item) after it submits the Block Settings command menu item for creation via validateBuildAndRunLegacyWorkspaceMigration and gets status === 'fail'. The thrown message embeds the full orchestrator failed result, whose report lists the failing command-menu-item validation(s).

Source

Thrown at 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:126

    const validateAndBuildResult =
      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunLegacyWorkspaceMigration(
        {
          isSystemBuild: true,
          allFlatEntityOperationByMetadataName: {
            commandMenuItem: {
              flatEntityToCreate: [itemToCreate],
              flatEntityToDelete: [],
              flatEntityToUpdate: [],
            },
          },
          workspaceId,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
        },
      );

    if (validateAndBuildResult.status === 'fail') {
      throw new Error(
        `Failed to add the Block Settings command menu item for workspace ${workspaceId}: ${JSON.stringify(
          validateAndBuildResult,
          null,
          2,
        )}`,
      );
    }

    this.logger.log(
      `Added the Block Settings command menu item for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Parse the JSON report in the thrown message to find the failing validation code and entity.
  2. Resolve the collision/dangling reference (remove the stray item row or seed the missing section).
  3. Invalidate the workspace cache and re-run the 2.28 command.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
  const report = JSON.parse(e.message.split(':').slice(1).join(':').trim());
  logger.error({ workspaceId, report }, 'Block Settings item create failed');
}

Prevention

When it happens

Trigger: A command menu item with EMAIL_BLOCK_SETTINGS_UNIVERSAL_IDENTIFIER already exists under a different shape (collision the early idempotency check did not catch); the item references a section/availability expression/object that is absent in the workspace; the generated migration cannot place the item at the requested position.

Common situations: An earlier partial run created the item partially; the standard definition's position/section references a navigation section absent in an older workspace; cross-version upgrade skipping the command that defines the target section.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/e53e1758f29b413e. Report an issue: GitHub.