Title: Encrypted Backup Restore Failing with "s2: corrupt input" Error in v25.0.0-preview4

I’m experiencing a persistent issue with encrypted backup restore in Dgraph v25.0.0-preview4 and would appreciate any guidance.

Both On Ubuntu 20.04 and On Ubuntu 25.04 : :

  • Dgraph version: v25.0.0-preview4

  • Commit: 684cbb2

  • Commit timestamp: 2025-05-21 15:58:51 -0400

  • Deployment: Docker Compose

  • Encryption: Enabled with --encryption key-file="/dgraph/enc_key_file"

The below is the logs of the alpha container

E1006 12:13:45.003231 1 draft.go:856] Applying proposal. Error: Failed to map the backup files: mapper.Map: s2: corrupt input

What I’ve Verified

:white_check_mark: Versions match exactly - Both Ubuntu 20.04 and Ubuntu 25.04 are identical (same commit hash, build date)
:white_check_mark: Encryption keys match - MD5 checksums verified: 9f74aea0ae866f4a059e12a3d3d1c0eb
:white_check_mark: Backup files intact - MD5 checksums match between source and destination
:white_check_mark: Multiple backup attempts - Tried both old and freshly created backups, same error

Steps to Reproduce

On Ubuntu 20.04 :

curl -X POST localhost:8080/admin
-H “Content-Type: application/json”
-d ‘{“query”: “mutation { backup(input: {destination: “/dgraph/backups”, forceFull: true}) { response { message code } taskId } }”}’

On Ubuntu 25.04 :

curl -X POST localhost:8080/admin
-H “Content-Type: application/json”
-d ‘{“query”: “mutation { restore(input: {location: “/dgraph/backups”, encryptionKeyFile: “/dgraph/enc_key_file”}) { code message } }”}’

Result: “Restore operation started” but fails with s2: corrupt input

Hey @Mohd_Arif ,

Are you saying this is a regression? In other words, if you try in 24.1.4 it works?

Hey @matthewmcneely

Yes, I have tested both version 24.1.4 and 25.0.0. Let me simplify the steps:

  1. Started Dgraph alpha with enc_key_file

  2. Created schema and data

  3. Exported backup

  4. Started another alpha instance using the same key

  5. Tried importing the backup

  6. Import is failing

Alpha container logs after importing

E1006 12:13:45.003231 1 draft.go:856] Applying proposal. Error: Failed to map the backup files: mapper.Map: s2: corrupt input

That error (s2: corrupt input) occurs when either the backup is encrypted but no/or the wrong key is offered for restore, or the backup is not encrypted but a key is offered.

It’s hard to say what’s happening without exact commands, but what does the manifest.json file in the backup directory look like?

I have confirmed that the encrypted restore integration test is passing with v25. This is the test: dgraph/systest/backup/encryption/backup_test.go at e6980befe54103c67f353ffaa311345747ebb147 · hypermodeinc/dgraph · GitHub

Have a look and see how your procedure differs.

Hi @matthewmcneely

I had an issue because the encryption key was corrupted. I took the key from the running Alpha container’s memory, and the issue is resolved.

I have another query: Is it possible to take binary (incremental) backups in the open source version?

Yes. All enterprise features were converted to open source in v25.