Budibase/budibase · error · BadRequestError
Column name cannot be empty
Error message
Column name cannot be empty
What it means
migrate() validates that the new column name is non-empty before performing the relationship-column migration; an empty string would create an unusable schema key, so a BadRequestError is thrown.
Source
Thrown at packages/server/src/sdk/workspace/tables/migration.ts:37
import sdk from "../.."
import { EventType, updateLinks } from "../../../db/linkedRows"
import { isExternalTableID } from "../../../integrations/utils"
export interface MigrationResult {
tablesUpdated: Table[]
}
export async function migrate(
table: Table,
oldColumnName: string,
newColumnName: string
): Promise<MigrationResult> {
if (newColumnName in table.schema) {
throw new BadRequestError(`Column "${newColumnName}" already exists`)
}
if (newColumnName === "") {
throw new BadRequestError(`Column name cannot be empty`)
}
if (isInternalColumnName(newColumnName)) {
throw new BadRequestError(`Column name cannot be a reserved column name`)
}
const oldColumn = table.schema[oldColumnName]
if (!oldColumn) {
throw new BadRequestError(
`Column "${oldColumnName}" does not exist on table "${table.name}"`
)
}
if (
oldColumn.type !== FieldType.LINK ||
oldColumn.tableId !== InternalTable.USER_METADATA
) {View on GitHub (pinned to a81a902e9a)
Solutions
- Pass a non-empty newColumnName after trimming user input
- Validate the name in the caller before invoking migrate
- Check that the variable holding the name is actually populated
- Add a trim+length check in your request handler
Example fix
// before
await sdk.tables.migration.migrate(table, oldCol, userInput)
// after
const name = userInput.trim()
if (!name) throw new Error('New column name required')
await sdk.tables.migration.migrate(table, oldCol, name) Defensive patterns
Strategy: validation
Validate before calling
const name = (userInput ?? '').trim()
if (!name) throw new Error('New column name is required') Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === 'string' && v.trim().length > 0
} Try / catch
try {
await sdk.tables.migration.migrate(table, oldName, newName)
} catch (e) {
if (e.message === 'Column name cannot be empty') {
// prompt for a valid name and retry
}
} Prevention
- Trim and require non-empty names in forms before submitting
- Guard unbound/optional variables passed as newName
- Validate at the API handler boundary, not just in migrate
When it happens
Trigger: Calling migrate(table, oldColumnName, '') — typically an unset form input or unbound variable passed as the new name.
Common situations: UI submitting a rename form with a blank field; a variable that failed to initialize; trimming not applied to whitespace-only input (only strict '' is caught here).
Related errors
- Invalid URL.
- Column "${newColumnName}" already exists
- Column name cannot be a reserved column name
- Column "${oldColumnName}" does not exist on table "${table.n
- External tables cannot be migrated
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/95219c1d64d0efeb.
Report an issue: GitHub.