Budibase/budibase · error · HTTPError
Workspace exports cannot be imported as Project packages.
Error message
Workspace exports cannot be imported as Project packages.
What it means
Workspace (app) exports contain a db.txt dump rather than the manifest.json/project.json layout of a project package. If the extracted archive root contains db.txt, extractProjectPackage() throws this HTTP 400 at imports.ts:944 to prevent importing the wrong artifact type via the project package import path.
Source
Thrown at packages/server/src/sdk/workspace/projects/backups/imports.ts:944
try {
if (encryptPassword) {
try {
await decryptFiles(tmpPath, encryptPassword)
} catch {
throw new HTTPError("Project package could not be decrypted.", 400)
}
}
const packageFiles = await readDirectoryRecursively(tmpPath)
const rootEntries = await fsp.readdir(tmpPath)
if (rootEntries.some(entry => entry.endsWith(".enc")) && !encryptPassword) {
throw new HTTPError(
"Files are encrypted but no password has been supplied.",
400
)
}
if (rootEntries.includes("db.txt")) {
throw new HTTPError(
"Workspace exports cannot be imported as Project packages.",
400
)
}
if (
rootEntries.some(
entry =>
![
PROJECT_MANIFEST_FILE,
PROJECT_FILE,
PROJECT_DEPENDENCY_INDEX_FILE,
PROJECT_DOCS_DIRECTORY,
].includes(entry)
)
) {
throw new HTTPError("Project package contains unsupported files.", 400)
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Export a proper project package (with manifest.json/project.json) from the source workspace and import that instead
- Use the workspace/app import endpoint for workspace exports rather than the project package import
- Check the archive contents before importing: db.txt means it's a workspace export
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
import { createReadStream } from 'fs'
import { parse } from 'tar'
const isWorkspaceExport = await new Promise<boolean>((resolve, reject) => {
const ws = parse({ onReadEntry: (e: any) => { if (e.path === 'db.txt' || e.path.endsWith('/db.txt')) { resolve(true); ws.abort?.() } }, onEnd: () => resolve(false) })
createReadStream(packagePath).pipe(ws as any)
ws.on('error', reject)
})
if (isWorkspaceExport) throw new Error('use the workspace export import endpoint, not project package import') Type guard
function isProjectPackageRootEntries(entries: readonly string[]): entries is readonly string[] {
return !entries.includes('db.txt')
} Try / catch
try {
await importProjectPackage(file)
} catch (err) {
if (err instanceof HTTPError && err.status === 400 && err.message.includes('cannot be imported as Project packages')) {
// route to the workspace/app import flow or obtain a project package export
} else {
throw err
}
} Prevention
- Label exported artifacts clearly (workspace export vs project package)
- Check for db.txt in the archive before calling the project import endpoint
- Use the correct download action in the UI/API for the import you intend
- Pin automation scripts to the endpoint matching the artifact type
When it happens
Trigger: Uploading a workspace/app export archive (containing db.txt) to the project-package import endpoint, triggering the check at imports.ts:943-946.
Common situations: Grabbing the wrong file from an export job (workspace export instead of project package); older automation scripts that used the app-export format; confusing the two download buttons/endpoints in the UI or API.
Related errors
- Project package contains too many docs.
- Project package contains unsupported doc files.
- Project package contains an invalid doc in '${basename(fileP
- Invalid bookmark query
- Invalid limit query
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/d7ee231239df39d0.
Report an issue: GitHub.