Budibase/budibase · error · Error

Self-referential relationships are not supported. Table ${ta

Error message

Self-referential relationships are not supported. Table ${table.name} cannot link to itself.

What it means

Error "Self-referential relationships are not supported. Table ${table.name} cannot link to itself." thrown in Budibase/budibase.

Source

Thrown at packages/server/src/sdk/workspace/ai/helpers/table.ts:28

export async function generateTables(
  tables: { name: string; primaryDisplay: string; schema: TableSchema }[]
) {
  const createdTables: GenerateTablesResponse["createdTables"] = []
  const tableIds: Record<string, string> = {}

  try {
    for (const table of tables) {
      for (const linkField of Object.values(table.schema).filter(
        f => f.type === FieldType.LINK
      )) {
        if (!tables.find(t => t.name === linkField.tableId)) {
          throw new Error(
            `Table ${linkField.tableId} not found in the json response.`
          )
        }
        if (linkField.tableId === table.name) {
          throw new Error(
            `Self-referential relationships are not supported. Table ${table.name} cannot link to itself.`
          )
        }
      }
    }

    const existingTableNames = (await sdk.tables.getAllInternalTables()).map(
      t => t.name
    )

    for (const table of tables) {
      const name = helpers.getSequentialName(existingTableNames, table.name, {
        separator: " ",
      })
      const createdTable = await sdk.tables.create({
        ...table,
        name,
        schema: {},

View on GitHub (pinned to a81a902e9a)

When it happens

Trigger: Thrown at packages/server/src/sdk/workspace/ai/helpers/table.ts:28 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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