Budibase/budibase · error · Error
Cannot re-use the linked column name for a linked table.
Error message
Cannot re-use the linked column name for a linked table.
What it means
`validateTable` tracks each link schema entry by `tableId + fieldName` in the `usedAlready` array while the table is saved. If two link columns resolve to the same unique key — the same fieldName used twice in one table, or the same fieldName on link columns pointing at the same table — the save is rejected to keep link document storage unambiguous.
Source
Thrown at packages/server/src/db/linkedRows/LinkController.ts:110
/**
* Makes sure the passed in table schema contains valid relationship structures.
*/
validateTable(table: Table) {
const usedAlready = []
for (let schema of Object.values(table.schema)) {
if (schema.type !== FieldType.LINK) {
continue
}
if (
schema.fieldName &&
!schema.autocolumn &&
!schema.fieldName.match(ValidColumnNameRegex)
) {
throw new Error("Column names can't contain special characters")
}
const unique = schema.tableId! + schema?.fieldName
if (usedAlready.indexOf(unique) !== -1) {
throw new Error(
"Cannot re-use the linked column name for a linked table."
)
}
usedAlready.push(unique)
}
}
/**
* Returns whether the two link schemas are equal (in the important parts, not a pure equality check)
*/
areLinkSchemasEqual(linkSchema1: FieldSchema, linkSchema2: FieldSchema) {
const compareFields = [
"name",
"type",
"tableId",
"fieldName",
"autocolumn",
"relationshipType",View on GitHub (pinned to a81a902e9a)
Solutions
- Rename one of the duplicate link columns so each fieldName is unique within the table.
- Inspect table.schema via the API and remove redundant duplicate link entries before saving.
- If the duplication comes from import code, deduplicate schema entries by fieldName before writing the table.
Example fix
// before
schema: { related_a: {type:"link", tableId: T}, related_a: {type:"link", tableId: T} }
// after
schema: { related_orders: {type:"link", tableId: T}, related_shipments: {type:"link", tableId: T} } Defensive patterns
Strategy: validation
Validate before calling
const seen = new Set<string>()
for (const [name, schema] of Object.entries(table.schema)) {
if (schema.type !== "link") continue
const key = schema.tableId + name
if (seen.has(key)) throw new Error(`Duplicate link column '${name}' for table ${schema.tableId}`)
seen.add(key)
} Try / catch
try {
await api.post(`/tables`, table)
} catch (err) {
if (err.message.includes("re-use the linked column name")) {
table.schema = dedupeLinkColumns(table.schema)
return api.post(`/tables`, table)
}
throw err
} Prevention
- Uniquely name every link column within a table.
- Deduplicate schema entries by fieldName before imports or PATCHes.
- Review duplicated table definitions for cloned link fields.
When it happens
Trigger: Defining two link columns with identical fieldName in a single table; a copy/paste or import creating duplicate link schema entries; API calls that PATCH the table schema appending a link column whose fieldName already exists on the same target table.
Common situations: Duplicating a table definition and accidentally duplicating link fields; CSV/table import tooling merging schemas; automation or plugin code updating the schema without checking for existing link field names.
Related errors
- Column names can't contain special characters
- Relationship Error: Invalid value
- DB does not exist
- CouchDB error: ${err.message}
- Unable to retrieve row ${row._id} after saving.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/6dcecde255030029.
Report an issue: GitHub.