{"record":{"id":"ae5e2066f8e7bf2e","repo":"twentyhq/twenty","slug":"failed-to-delete-gauge-widgets-for-workspace-wor","errorCode":null,"errorMessage":"Failed to delete gauge widgets for workspace ${workspaceId}","messagePattern":"Failed to delete gauge widgets for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-3/2-3-workspace-command-1798000000000-delete-gauge-widgets.command.ts","lineNumber":104,"sourceCode":"        {\n          allFlatEntityOperationByMetadataName: {\n            pageLayoutWidget: {\n              flatEntityToCreate: [],\n              flatEntityToDelete: gaugeWidgets,\n              flatEntityToUpdate: [],\n            },\n          },\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (result.status === 'fail') {\n      this.logger.error(\n        `Failed to delete gauge widgets in workspace ${workspaceId}:\\n${JSON.stringify(result, null, 2)}`,\n      );\n      throw new Error(\n        `Failed to delete gauge widgets for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(\n      `Deleted ${gaugeWidgets.length} gauge widget(s) for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":86,"sourceCodeEnd":114,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-3/2-3-workspace-command-1798000000000-delete-gauge-widgets.command.ts#L86-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the logged JSON report to find the blocking widget(s) and dependency.","Remove the dependent page-layout-tab/section rows, then re-run the 2.3 command.","If widgets are already gone, mark the workspace handled and clear orphans manually."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm gauge widgets are not still referenced by a live page layout tab:\nconst orphans = gaugeWidgets.filter(w => !pageLayoutTabMaps.byId[w.pageLayoutTabId]);\nif (orphans.length > 0) { /* reconcile before running */ }","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (e) {\n  logger.error({ workspaceId, err: e.message }, 'gauge widget delete failed');\n}","preventionTips":["Remove dependent page-layout-tab/section rows before deleting widgets.","On partial failure, clear orphaned widget rows before retrying."],"tags":["migration","upgrade-command","validate-and-build","workspace","page-layout-widget","gauge-widget","delete"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}