Budibase/budibase · error · HTTPError

Project package could not be decrypted.

Error message

Project package could not be decrypted.

What it means

After extraction, if an encryptPassword was supplied, decryptFiles() is run over the package contents; any failure is converted into this HTTP 400 at imports.ts:931. It almost always means the password is wrong or the archive is not the encrypted package it claims to be — the raw decrypt error is swallowed and replaced by this generic message.

Source

Thrown at packages/server/src/sdk/workspace/projects/backups/imports.ts:931

  file: { path: string },
  encryptPassword?: string
): Promise<ExtractedProjectPackage> {
  const fileStats = await fsp.stat(file.path)
  if (fileStats.size > MAX_ARCHIVE_SIZE_BYTES) {
    throw new HTTPError("Project package is too large.", 400)
  }
  if (encryptPassword && encryptPassword.length > MAX_ENCRYPT_PASSWORD_LENGTH) {
    throw new HTTPError("Project package password is too long.", 400)
  }

  await validateProjectPackageBeforeExtraction(file)
  const tmpPath = await untarFile(file)
  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 (

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Re-enter the exact password used when the package was exported, without trailing whitespace
  2. Re-export the package from the source workspace with a known password and retry
  3. Verify the .enc files are intact (re-upload/re-download; compare checksums if possible)
  4. If you have the password but decryption still fails, the package may use an incompatible encryption version — re-export on a matching Budibase version
Defensive patterns

Strategy: try-catch

Validate before calling

// cannot pre-verify decryption without decrypting, but confirm password is present and well-formed
if (!password || password.length === 0) throw new Error('a password is required for encrypted packages')
// optionally peek into the tarball to confirm .enc files exist and match the export that used this password

Type guard

function isPlausiblePassword(p: unknown): p is string {
  return typeof p === 'string' && p.length > 0 && p === p.trim()
}

Try / catch

try {
  await importProjectPackage(file, password)
} catch (err) {
  if (err instanceof HTTPError && err.status === 400 && err.message === 'Project package could not be decrypted.') {
    // wrong password or corrupt archive: confirm password with exporter, or re-export
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Importing a package with encryptPassword set while decryptFiles(tmpPath, encryptPassword) throws at imports.ts:930 (wrong password, corrupted .enc files, package encrypted with a different scheme/key).

Common situations: Password mismatch after re-exporting with a new password; copy/paste errors or trailing whitespace in the password; partial/corrupted upload; importing a package encrypted by an older Budibase version with a different encryption format.

Related errors


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