twentyhq/twenty · error · Error

Failed to delete channel standard objects for workspace

Error message

Failed to delete channel standard objects for workspace ${workspaceId}

What it means

Thrown by the 2.8 command that drops channel standard objects. It builds object/relation delete operations for the channel objects and submits them via validateBuildAndRunLegacyWorkspaceMigration; on status === 'fail' it logs the report and throws. The report identifies which channel object delete failed.

Solutions

  1. Read the logged JSON report to find the blocking dependency.
  2. Remove or reassign the dependent relation/view/field rows referencing channel objects.
  3. Re-run the 2.8 command; if the objects are already gone, mark the workspace handled.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm no live relations still reference channel objects before dropping:
const refs = Object.values(flatRelationMetadataMaps.byId).filter(r => CHANNEL_OBJECT_UIS.includes(r.fromObjectMetadataUniversalIdentifier) || CHANNEL_OBJECT_UIS.includes(r.toObjectMetadataUniversalIdentifier));
if (refs.length > 0) { /* drop or reassign them first */ }

Try / catch

try {
  await command.runOnWorkspace({ workspaceId, options });
} catch (e) {
  logger.error({ workspaceId, err: e.message }, 'channel objects drop failed');
}

Prevention

When it happens

Trigger: A channel object is referenced by a relation or view on another object that blocks deletion; a channel object was already removed in a prior run; custom fields/relations on the channel objects prevent the drop.

Common situations: Prior interrupted 2.8 run; message/participant objects still hold relations to channel; cross-version upgrade skipping dependent-relation cleanup.

Related errors


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

Appendix: source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-8/2-8-workspace-command-1798000050000-drop-channel-standard-objects.command.ts:110

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

    if (validateAndBuildResult.status === 'fail') {
      this.logger.error(
        `Failed to delete channel standard objects:\n${JSON.stringify(validateAndBuildResult, null, 2)}`,
      );

      throw new Error(
        `Failed to delete channel standard objects for workspace ${workspaceId}`,
      );
    }

    this.logger.log(
      `Deleted ${objectsToDelete.length} channel standard objects for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)