{"record":{"id":"f086a18eddf00004","repo":"twentyhq/twenty","slug":"failed-to-delete-connectedaccount-standard-object","errorCode":null,"errorMessage":"Failed to delete connectedAccount standard object for workspace ${workspaceId}","messagePattern":"Failed to delete connectedAccount standard object for workspace (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/twenty-server/src/database/commands/upgrade-version-command/2-7/2-7-workspace-command-1798000040000-drop-connected-account-standard-object.command.ts","lineNumber":136,"sourceCode":"                    flatEntityToCreate: [],\n                    flatEntityToDelete: relationFieldsToDelete,\n                    flatEntityToUpdate: [],\n                  },\n                }\n              : {}),\n          },\n          workspaceId,\n          applicationUniversalIdentifier:\n            twentyStandardFlatApplication.universalIdentifier,\n        },\n      );\n\n    if (validateAndBuildResult.status === 'fail') {\n      this.logger.error(\n        `Failed to delete connectedAccount standard object:\\n${JSON.stringify(validateAndBuildResult, null, 2)}`,\n      );\n\n      throw new Error(\n        `Failed to delete connectedAccount standard object for workspace ${workspaceId}`,\n      );\n    }\n\n    this.logger.log(\n      `Deleted connectedAccount standard object and relation fields for workspace ${workspaceId}`,\n    );\n  }\n}\n","sourceCodeStart":118,"sourceCodeEnd":146,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-server/src/database/commands/upgrade-version-command/2-7/2-7-workspace-command-1798000040000-drop-connected-account-standard-object.command.ts#L118-L146","documentation":"Thrown by the 2.7 command that drops the connectedAccount standard object (and its relation fields). It submits the object/field delete operations via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it logs the report and throws. The report shows which object/field delete was blocked.","triggerScenarios":"The connectedAccount object is referenced by a still-existing relation, view, or custom field on another object (cascade blocked); connectedAccount was already removed in a prior run so the delete targets nothing; a workspace has custom records/relations pointing at connectedAccount that prevent the drop.","commonSituations":"A prior interrupted 2.7 run; custom relations built on connectedAccount before it was deprecated; cross-version upgrade skipping the command that cleans up dependent relations first.","solutions":["Read the logged JSON report to identify the blocking dependency (relation/view/field).","Remove or reassign the dependent relation/view/field rows for connectedAccount.","Re-run the 2.7 command; if the object is already gone, mark the workspace handled."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm no live relations still reference connectedAccount before dropping:\nconst refs = Object.values(flatRelationMetadataMaps.byId).filter(r => r.fromObjectMetadataUniversalIdentifier === CONNECTED_ACCOUNT_UI || r.toObjectMetadataUniversalIdentifier === CONNECTED_ACCOUNT_UI);\nif (refs.length > 0) { /* drop or reassign them first */ }","typeGuard":null,"tryCatchPattern":"try {\n  await command.runOnWorkspace({ workspaceId, options });\n} catch (e) {\n  logger.error({ workspaceId, err: e.message }, 'connectedAccount drop failed');\n}","preventionTips":["Remove dependent relations/views on connectedAccount before its drop command.","On partial failure, clear orphaned rows before retrying."],"tags":["migration","upgrade-command","validate-and-build","workspace","object-metadata","connected-account","drop-object"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}