{"record":{"id":"b21010cbc49c4212","repo":"Budibase/budibase","slug":"table-linkfield-tableid-not-found-in-the-json-r","errorCode":null,"errorMessage":"Table ${linkField.tableId} not found in the json response.","messagePattern":"Table (.+?) not found in the json response\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/helpers/table.ts","lineNumber":23,"sourceCode":"  TableSchema,\n  TableSourceType,\n} from \"@budibase/types\"\nimport sdk from \"../../..\"\nimport { helpers } from \"@budibase/shared-core\"\n\nexport async function generateTables(\n  tables: { name: string; primaryDisplay: string; schema: TableSchema }[]\n) {\n  const createdTables: GenerateTablesResponse[\"createdTables\"] = []\n  const tableIds: Record<string, string> = {}\n\n  try {\n    for (const table of tables) {\n      for (const linkField of Object.values(table.schema).filter(\n        f => f.type === FieldType.LINK\n      )) {\n        if (!tables.find(t => t.name === linkField.tableId)) {\n          throw new Error(\n            `Table ${linkField.tableId} not found in the json response.`\n          )\n        }\n        if (linkField.tableId === table.name) {\n          throw new Error(\n            `Self-referential relationships are not supported. Table ${table.name} cannot link to itself.`\n          )\n        }\n      }\n    }\n\n    const existingTableNames = (await sdk.tables.getAllInternalTables()).map(\n      t => t.name\n    )\n\n    for (const table of tables) {\n      const name = helpers.getSequentialName(existingTableNames, table.name, {\n        separator: \" \",","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/helpers/table.ts#L5-L41","documentation":"Error \"Table ${linkField.tableId} not found in the json response.\" thrown in Budibase/budibase.","triggerScenarios":"Thrown at packages/server/src/sdk/workspace/ai/helpers/table.ts:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}