{"record":{"id":"41c8b7bdf1f8ed5b","repo":"Budibase/budibase","slug":"column-newcolumn-name-is-not-a-user-column","errorCode":null,"errorMessage":"Column \"${newColumn.name}\" is not a user column","messagePattern":"Column \"(.+?)\" is not a user column","errorType":"validation","errorClass":"BadRequestError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/tables/migration.ts","lineNumber":117,"sourceCode":"  newColumn: FieldSchema\n): ColumnMigrator {\n  // For now, we're only supporting migrations of user relationships to user\n  // columns in internal tables. In the future, we may want to support other\n  // migrations but for now return an error if we aren't migrating a user\n  // relationship.\n  if (isExternalTableID(table._id!)) {\n    throw new BadRequestError(\"External tables cannot be migrated\")\n  }\n\n  if (!(oldColumn.name in table.schema)) {\n    throw new BadRequestError(`Column \"${oldColumn.name}\" does not exist`)\n  }\n\n  if (\n    newColumn.type !== FieldType.BB_REFERENCE_SINGLE &&\n    newColumn.type !== FieldType.BB_REFERENCE\n  ) {\n    throw new BadRequestError(`Column \"${newColumn.name}\" is not a user column`)\n  }\n\n  if (newColumn.subtype !== BBReferenceFieldSubType.USER) {\n    throw new BadRequestError(`Column \"${newColumn.name}\" is not a user column`)\n  }\n\n  if (!isRelationshipField(oldColumn)) {\n    throw new BadRequestError(\n      `Column \"${oldColumn.name}\" is not a user relationship`\n    )\n  }\n\n  if (oldColumn.tableId !== InternalTable.USER_METADATA) {\n    throw new BadRequestError(\n      `Column \"${oldColumn.name}\" is not a user relationship`\n    )\n  }\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/tables/migration.ts#L99-L135","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-crafting a migration payload (custom scripts or internal tooling) with the wrong FieldType; copy-pasting a schema definition from another column type.","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"],"exampleFix":"// before\nconst newColumn = { name: \"userRef\", type: FieldType.STRING, subtype: BBReferenceFieldSubType.USER }\n// after\nconst newColumn = { name: \"userRef\", type: FieldType.BB_REFERENCE_SINGLE, subtype: BBReferenceFieldSubType.USER }","handlingStrategy":"validation","validationCode":"const valid = [FieldType.BB_REFERENCE_SINGLE, FieldType.BB_REFERENCE]\nif (!valid.includes(newColumn.type)) {\n  throw new Error(`${newColumn.name} must be a user reference column`)\n}","typeGuard":"const isUserColumnType = (c: FieldSchema): boolean =>\n  c.type === FieldType.BB_REFERENCE_SINGLE || c.type === FieldType.BB_REFERENCE","tryCatchPattern":null,"preventionTips":["Derive the target column type from the relationship instead of hardcoding it","Prefer the top-level migrate() helper over constructing newColumn manually"],"tags":["bad-request","schema","field-type","migration"],"backgroundTag":"invalid-field-type","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}