twentyhq/twenty · error · Error

Failed to delete gauge widgets for workspace ${workspaceId}

Error message

Failed to delete gauge widgets for workspace ${workspaceId}

What it means

Thrown by the 2.3 command that deletes gauge widgets from workspaces. It builds page-layout-widget delete operations for gauge widgets and submits them via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it logs the report and throws. The report identifies which widget(s) could not be deleted.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-3/2-3-workspace-command-1798000000000-delete-gauge-widgets.command.ts:104

        {
          allFlatEntityOperationByMetadataName: {
            pageLayoutWidget: {
              flatEntityToCreate: [],
              flatEntityToDelete: gaugeWidgets,
              flatEntityToUpdate: [],
            },
          },
          workspaceId,
          applicationUniversalIdentifier:
            twentyStandardFlatApplication.universalIdentifier,
        },
      );

    if (result.status === 'fail') {
      this.logger.error(
        `Failed to delete gauge widgets in workspace ${workspaceId}:\n${JSON.stringify(result, null, 2)}`,
      );
      throw new Error(
        `Failed to delete gauge widgets for workspace ${workspaceId}`,
      );
    }

    this.logger.log(
      `Deleted ${gaugeWidgets.length} gauge widget(s) for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Read the logged JSON report to find the blocking widget(s) and dependency.
  2. Remove the dependent page-layout-tab/section rows, then re-run the 2.3 command.
  3. If widgets are already gone, mark the workspace handled and clear orphans manually.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm gauge widgets are not still referenced by a live page layout tab:
const orphans = gaugeWidgets.filter(w => !pageLayoutTabMaps.byId[w.pageLayoutTabId]);
if (orphans.length > 0) { /* reconcile before running */ }

Try / catch

try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
  logger.error({ workspaceId, err: e.message }, 'gauge widget delete failed');
}

Prevention

When it happens

Trigger: A gauge widget is referenced by a page layout tab/section that blocks the delete; the widget id no longer resolves (already removed); a dependent view/view-field tied to the widget prevents removal.

Common situations: A prior interrupted run deleted some gauge widgets but left orphans; custom dashboards referencing the gauge widgets; widgets whose page-layout container was already removed.

Related errors


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