Budibase/budibase · error
Unable to retrieve workspace metadata for import - ${err.mes
Error message
Unable to retrieve workspace metadata for import - ${err.message} What it means
getNewWorkspaceMetadata reads the workspace metadata doc (docId WORKSPACE_METADATA) from both the temporary import DB and the target workspace DB. If either read fails (missing doc, DB unavailable, malformed export), the original error is wrapped in a plain Error prefixed 'Unable to retrieve workspace metadata for import'.
Source
Thrown at packages/server/src/sdk/workspace/workspaces/import.ts:58
const [tempMetadata, workspaceMetadata] = await Promise.all([
tempDb.get<Workspace>(docId),
workspaceDb.get<Workspace>(docId),
])
return {
...workspaceMetadata,
automationErrors: undefined,
theme: tempMetadata.theme,
customTheme: tempMetadata.customTheme,
snippets: tempMetadata.snippets,
features: tempMetadata.features,
icon: tempMetadata.icon,
navigation: tempMetadata.navigation,
scripts: tempMetadata.scripts,
type: tempMetadata.type,
version: tempMetadata.version,
}
} catch (err: any) {
throw new Error(
`Unable to retrieve workspace metadata for import - ${err.message}`
)
}
}
function mergeUpdateAndDeleteDocuments(
updateDocs: Document[],
deleteDocs: Document[],
metadata: Workspace
) {
// compress the documents to create and to delete (if same ID, then just update the rev)
const finalToDelete = []
for (let deleteDoc of deleteDocs) {
const found = updateDocs.find(doc => doc._id === deleteDoc._id)
if (found) {
found._rev = deleteDoc._rev
} else {
finalToDelete.push(deleteDoc)View on GitHub (pinned to a81a902e9a)
Solutions
- Re-export the app and confirm the export contains the workspace metadata doc
- Verify the target workspace exists and its DB has a valid metadata doc before importing
- Check the wrapped err.message in the error text to identify the root cause (404 vs connection)
- Confirm export/import compatibility between Budibase versions
Defensive patterns
Strategy: validation
Validate before calling
const tempMetadata = await tempDb.tryGet(DocumentType.WORKSPACE_METADATA)
const targetMetadata = await workspaceDb.tryGet(DocumentType.WORKSPACE_METADATA)
if (!tempMetadata || !targetMetadata) {
throw new Error('Export or target workspace is missing workspace metadata doc')
} Type guard
function isWorkspaceMetadata(doc) {
return !!doc && typeof doc === 'object' && !!doc._id && doc._id.startsWith('workspace_meta')
} Try / catch
try {
await importToWorkspace(...)
} catch (e) {
if (e?.message?.startsWith('Unable to retrieve workspace metadata for import')) {
// inspect inner message; re-export or verify target workspace
} else throw e
} Prevention
- Validate export archives contain the workspace metadata doc before importing
- Re-export from a compatible Budibase version
- Verify the target workspace DB is healthy before import
When it happens
Trigger: Calling importToWorkspace/newMetadata with an export whose temp DB lacks a valid workspace metadata doc, or when the target workspace DB cannot return its metadata doc (e.g. importing into a corrupt or non-workspace DB).
Common situations: Uploading a truncated/corrupted app export file; importing an export from an incompatible Budibase version; target workspace DB was deleted or never initialized; file path points to the wrong artifact.
Related errors
- Unable to determine delimiter
- TableImportError(errors)
- Invalid import url
- Only HTTP(S) URLs are allowed for query import
- Import url must not contain credentials
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/a6873abebebe3018.
Report an issue: GitHub.