twentyhq/twenty · critical · Error

Failed to create the workspaceMember openRecordIn field for

Error message

Failed to create the workspaceMember openRecordIn field for workspace ${workspaceId}

What it means

Thrown by the 2.27 command that creates the workspaceMember.openRecordIn field. After submitting the field-metadata create operation through validateBuildAndRunLegacyWorkspaceMigration and getting status === 'fail', it logs the result then throws. The embedded report points at the specific flat-field validation that rejected the new field.

Source

Thrown at packages/twenty-server/src/database/commands/upgrade-version-command/2-27/2-27-workspace-command-1785505000000-add-workspace-member-open-record-in.command.ts:136

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

    if (result.status === 'fail') {
      this.logger.error(
        `Failed to create the workspaceMember openRecordIn field:\n${JSON.stringify(result, null, 2)}`,
      );

      throw new Error(
        `Failed to create the workspaceMember openRecordIn field for workspace ${workspaceId}`,
      );
    }

    this.logger.log(
      `Created the workspaceMember openRecordIn field for workspace ${workspaceId}`,
    );
  }
}

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Read the logged JSON report to find which validation rule rejected the field create.
  2. Check whether openRecordIn already exists on workspaceMember for the workspace and, if it does in a bad shape, correct or remove it so the create is idempotent.
  3. Confirm the workspaceMember object is present and active in the workspace metadata.
  4. Re-run the 2.27 workspace command once the conflict clears.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check the field does not already exist in a bad shape:
const existing = flatFieldMetadataMaps.byUniversalIdentifier[OPEN_RECORD_IN_UI];
if (isDefined(existing) && existing.objectMetadataUniversalIdentifier !== WORKSPACE_MEMBER_UI) {
  // reconcile before running the 2.27 command
}

Try / catch

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

Prevention

When it happens

Trigger: The openRecordIn field universalIdentifier already exists on workspaceMember under a different type/label (collision); the workspaceMember object metadata is missing or deactivated so the field cannot attach; a relation referenced by the field's settings is absent; the column the field maps to already exists in the workspace schema with an incompatible type.

Common situations: A workspace where openRecordIn was manually added or partially seeded; workspaceMember object was renamed/deleted by a custom migration; schema column name collision from a prior field that was soft-deleted but not dropped.

Related errors


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