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
- Set newColumn.type to FieldType.BB_REFERENCE_SINGLE (single user) or FieldType.BB_REFERENCE (multi user)
- Set newColumn.subtype to BBReferenceFieldSubType.USER as well
- 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
- Derive the target column type from the relationship instead of hardcoding it
- Prefer the top-level migrate() helper over constructing newColumn manually
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
- Column "${oldColumn.name}" does not exist
- Column "${oldColumn.name}" is not a user relationship
- Column "${oldColumn.name}" is a one-to-many column but "${ne
- Column "${oldColumn.name}" is a ${oldColumn.relationshipType
- Unknown migration type
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/41c8b7bdf1f8ed5b.
Report an issue: GitHub.