{"record":{"id":"03f561f9847071d2","repo":"Budibase/budibase","slug":"project-import-could-not-remap-table-for-row-actio","errorCode":null,"errorMessage":"Project import could not remap table for row actions '${doc._id}'.","messagePattern":"Project import could not remap table for row actions '(.+?)'\\.","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/projects/backups/imports.ts","lineNumber":626,"sourceCode":"      })\n    case ResourceType.TABLE:\n      return generateTableID()\n    case ResourceType.QUERY: {\n      const datasourceId = doc.datasourceId && idMap.get(doc.datasourceId)\n      if (!datasourceId) {\n        throw new HTTPError(\n          `Project import could not remap datasource for query '${doc._id}'.`,\n          400\n        )\n      }\n      return generateQueryID(datasourceId)\n    }\n    case ResourceType.AUTOMATION:\n      return generateAutomationID()\n    case ResourceType.ROW_ACTION: {\n      const tableId = idMap.get(extractTableIdFromRowActionsID(doc._id!))\n      if (!tableId) {\n        throw new HTTPError(\n          `Project import could not remap table for row actions '${doc._id}'.`,\n          400\n        )\n      }\n      return generateRowActionsID(tableId)\n    }\n    case ResourceType.WORKSPACE_APP:\n      return docIds.generateWorkspaceAppID()\n    case ResourceType.SCREEN:\n      return generateScreenID()\n    default:\n      throw new HTTPError(\n        `Project import does not support resource type '${resourceType}'.`,\n        400\n      )\n  }\n}\n","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/backups/imports.ts#L608-L644","documentation":"When importing ROW_ACTION documents, the import derives the original table ID from the row action doc ID (extractTableIdFromRowActionsID) and looks it up in the idMap to remap it to the new table ID. This error is thrown when that table was not remapped, so a valid new table ID cannot be generated. The import fails with HTTP 400 because row actions cannot exist without their table.","triggerScenarios":"Importing a package whose row action doc references a table ID not present in the idMap — the table doc was missing from the export, failed to import, or the row action doc _id is malformed so extraction yields a nonexistent table ID.","commonSituations":"Packages manually edited to remove tables but keep row actions; corrupted or truncated exports; row action docs copied between workspaces.","solutions":["Include the table documents for all row actions in the export package.","Verify row action doc IDs are well-formed so extractTableIdFromRowActionsID yields the correct table ID.","Re-export the project instead of hand-editing package contents.","Strip orphaned row action docs from the package if their tables are intentionally excluded."],"exampleFix":"// before\n{ \"ROW_ACTION\": [{ \"_id\": \"rowactions_table_orphan_abc\" }] }\n// after (table included so idMap has a mapping)\n{ \"TABLE\": [{ \"_id\": \"table_orphan_abc\" }], \"ROW_ACTION\": [{ \"_id\": \"rowactions_table_orphan_abc\" }] }","handlingStrategy":"validation","validationCode":"const tableIds = new Set(docs.filter(d => d.type === ResourceType.TABLE).map(d => d._id))\nfor (const ra of docs.filter(d => d.type === ResourceType.ROW_ACTION)) {\n  if (!tableIds.has(extractTableIdFromRowActionsID(ra._id))) throw new Error(`Row action ${ra._id} has no matching table`)\n}","typeGuard":"const hasValidTableRef = (ra: RowAction): boolean => {\n  try { return typeof extractTableIdFromRowActionsID(ra._id) === \"string\" } catch { return false }\n}","tryCatchPattern":"try {\n  await importProjectPackage(file)\n} catch (err) {\n  if (err instanceof HTTPError && err.status === 400 && err.message.includes(\"remap table for row actions\")) {\n    // identify orphaned row action docs from err.message\n  }\n  throw err\n}","preventionTips":["Never delete tables from an export without also deleting their row actions","Keep row action doc IDs intact when editing packages","Re-export instead of mutating archives"],"tags":["import","id-mapping","row-action","table"],"backgroundTag":"import-id-remap-missing-parent","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}