Budibase/budibase · error · BadRequestError

Column "${oldColumn.name}" is a ${oldColumn.relationshipType

Error message

Column "${oldColumn.name}" is a ${oldColumn.relationshipType} column but "${newColumn.name}" is not a multi user column

What it means

MANY_TO_MANY and MANY_TO_ONE relationships can hold multiple users, so the target must be the multi-user column type (BB_REFERENCE). getColumnMigrator throws this BadRequestError when these relationships are paired with a BB_REFERENCE_SINGLE target.

Source

Thrown at packages/server/src/sdk/workspace/tables/migration.ts:149

    throw new BadRequestError(
      `Column "${oldColumn.name}" is not a user relationship`
    )
  }

  if (oldColumn.relationshipType === RelationshipType.ONE_TO_MANY) {
    if (newColumn.type !== FieldType.BB_REFERENCE_SINGLE) {
      throw new BadRequestError(
        `Column "${oldColumn.name}" is a one-to-many column but "${newColumn.name}" is not a single user column`
      )
    }
    return new SingleUserColumnMigrator(table, oldColumn, newColumn)
  }
  if (
    oldColumn.relationshipType === RelationshipType.MANY_TO_MANY ||
    oldColumn.relationshipType === RelationshipType.MANY_TO_ONE
  ) {
    if (newColumn.type !== FieldType.BB_REFERENCE) {
      throw new BadRequestError(
        `Column "${oldColumn.name}" is a ${oldColumn.relationshipType} column but "${newColumn.name}" is not a multi user column`
      )
    }

    return new MultiUserColumnMigrator(table, oldColumn, newColumn)
  }

  throw new BadRequestError(`Unknown migration type`)
}

abstract class UserColumnMigrator<T> implements ColumnMigrator {
  constructor(
    protected table: Table,
    protected oldColumn: RelationshipFieldMetadata,
    protected newColumn: T
  ) {}

  abstract updateRow(row: Row, linkInfo: LinkInfo): void

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Use FieldType.BB_REFERENCE (with constraints.type "array") as the target for MANY_TO_MANY / MANY_TO_ONE relationships
  2. Derive the target type from oldColumn.relationshipType before constructing newColumn
  3. Let the top-level migrate() function determine the correct type from cardinality

Example fix

// before
const newColumn = { name: "members", type: FieldType.BB_REFERENCE_SINGLE, subtype: BBReferenceFieldSubType.USER }
// after
const newColumn = { name: "members", type: FieldType.BB_REFERENCE, subtype: BBReferenceFieldSubType.USER, constraints: { type: "array" } }
Defensive patterns

Strategy: validation

Validate before calling

if ((oldColumn.relationshipType === RelationshipType.MANY_TO_MANY ||
     oldColumn.relationshipType === RelationshipType.MANY_TO_ONE) &&
    newColumn.type !== FieldType.BB_REFERENCE) {
  throw new Error("Multi relationships must migrate to a multi user column")
}

Prevention

When it happens

Trigger: Invoking the migrator with oldColumn.relationshipType of MANY_TO_MANY or MANY_TO_ONE and newColumn.type === FieldType.BB_REFERENCE_SINGLE instead of FieldType.BB_REFERENCE.

Common situations: Reusing a single-user target column definition across multiple relationships of differing cardinality in a batch migration.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/c536a6b5455a07d9. Report an issue: GitHub.