Budibase/budibase · error · BadRequestError

Column "${newColumn.name}" is not a user column

Error message

Column "${newColumn.name}" is not a user column

What it means

The target column of the migration must be a user column: its FieldType must be BB_REFERENCE_SINGLE or BB_REFERENCE. getColumnMigrator throws this BadRequestError when newColumn.type is anything else, because only user-reference columns are valid migration targets.

Source

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

  newColumn: FieldSchema
): ColumnMigrator {
  // For now, we're only supporting migrations of user relationships to user
  // columns in internal tables. In the future, we may want to support other
  // migrations but for now return an error if we aren't migrating a user
  // relationship.
  if (isExternalTableID(table._id!)) {
    throw new BadRequestError("External tables cannot be migrated")
  }

  if (!(oldColumn.name in table.schema)) {
    throw new BadRequestError(`Column "${oldColumn.name}" does not exist`)
  }

  if (
    newColumn.type !== FieldType.BB_REFERENCE_SINGLE &&
    newColumn.type !== FieldType.BB_REFERENCE
  ) {
    throw new BadRequestError(`Column "${newColumn.name}" is not a user column`)
  }

  if (newColumn.subtype !== BBReferenceFieldSubType.USER) {
    throw new BadRequestError(`Column "${newColumn.name}" is not a user column`)
  }

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

  if (oldColumn.tableId !== InternalTable.USER_METADATA) {
    throw new BadRequestError(
      `Column "${oldColumn.name}" is not a user relationship`
    )
  }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Set newColumn.type to FieldType.BB_REFERENCE_SINGLE (single user) or FieldType.BB_REFERENCE (multi user)
  2. Set newColumn.subtype to BBReferenceFieldSubType.USER as well
  3. Let migrate() build the new column for you instead of supplying one manually

Example fix

// before
const newColumn = { name: "userRef", type: FieldType.STRING, subtype: BBReferenceFieldSubType.USER }
// after
const newColumn = { name: "userRef", type: FieldType.BB_REFERENCE_SINGLE, subtype: BBReferenceFieldSubType.USER }
Defensive patterns

Strategy: validation

Validate before calling

const valid = [FieldType.BB_REFERENCE_SINGLE, FieldType.BB_REFERENCE]
if (!valid.includes(newColumn.type)) {
  throw new Error(`${newColumn.name} must be a user reference column`)
}

Type guard

const isUserColumnType = (c: FieldSchema): boolean =>
  c.type === FieldType.BB_REFERENCE_SINGLE || c.type === FieldType.BB_REFERENCE

Prevention

When it happens

Trigger: Constructing or passing a new column whose type is text/number/link/etc. instead of FieldType.BB_REFERENCE_SINGLE or FieldType.BB_REFERENCE when invoking the migrator.

Common situations: Hand-crafting a migration payload (custom scripts or internal tooling) with the wrong FieldType; copy-pasting a schema definition from another column type.

Related errors


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