twentyhq/twenty · error · Error

Failed to fix "Go to Roles Settings" command menu item path

Error message

Failed to fix "Go to Roles Settings" command menu item path for workspace ${workspaceId}

What it means

Thrown by the 2.23 command that fixes the 'Go to Roles Settings' command menu item path to /settings/members#roles. The command computes the update operations via buildFixGoToRolesSettingsCommandMenuItemPathSyncOperations, then calls validateBuildAndRunWorkspaceMigration with commandMenuItem update operations. If the pipeline fails, the detailed report is logged to logger.error and the generic error is thrown.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-23/2-23-workspace-command-1784566000000-fix-go-to-roles-settings-command-menu-item-path.command.ts:87

    const validateAndBuildResult =
      await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigration(
        {
          isSystemBuild: true,
          workspaceId,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
          allFlatEntityOperationByMetadataName: {
            commandMenuItem: commandMenuItemOperations,
          },
        },
      );

    if (validateAndBuildResult.status === 'fail') {
      this.logger.error(
        `Failed to fix "Go to Roles Settings" command menu item path:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
      );

      throw new Error(
        `Failed to fix "Go to Roles Settings" command menu item path for workspace ${workspaceId}`,
      );
    }

    this.logger.log(
      `Successfully fixed "Go to Roles Settings" command menu item path for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Read the logger.error JSON output for the specific failure report
  2. Flush flatCommandMenuItemMaps from workspace cache and retry — the command is idempotent (skips if no updates needed)
  3. Verify the 'Go to Roles Settings' command menu item exists in the workspace metadata
  4. Run with --dryRun to inspect the planned updates
Defensive patterns

Strategy: retry

Validate before calling

// Before running, flush command menu item cache
await workspaceCacheService.invalidateAndRecompute(workspaceId, [
  'flatCommandMenuItemMaps',
]);

// Confirm the Go to Roles Settings item exists
const { flatCommandMenuItemMaps } = await workspaceCacheService.getOrRecompute(workspaceId, [
  'flatCommandMenuItemMaps',
]);

const hasItem = Object.values(flatCommandMenuItemMaps.byUniversalIdentifier)
  .filter(isDefined)
  .some((item) => item.path?.includes('roles'));

if (!hasItem) {
  console.log('Go to Roles Settings item not found — command will skip');
}

Try / catch

// Retry once after flushing cache — the command is idempotent
try {
  await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
} catch (error) {
  if (error.message.includes('Failed to fix "Go to Roles Settings"')) {
    await workspaceCacheService.flush(workspaceId, ['flatCommandMenuItemMaps']);
    await command.runOnWorkspace({ workspaceId, options: { dryRun: false } });
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: validateBuildAndRunWorkspaceMigration returns status 'fail' when updating commandMenuItem flat entities. Caused by: the 'Go to Roles Settings' command menu item not existing in the workspace (the sync-operations builder produced updates for a non-existent row), stale flatCommandMenuItemMaps cache, or a validation rejection of the new path value.

Common situations: Workspace was provisioned on a version that didn't include the 'Go to Roles Settings' menu item; the command menu item was deleted by a user; cache is stale and reports the item as present when it's not.

Related errors


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