Error when trying to restore Dgraph backup

I’m running the following command dgraph restore -p /home/dmitry/dgraph/dgraph -l /home/dmitry/dgraph/backups -z localhost:5080 --backup_id lucid_darwin0

However it gives me the following error: gzip: invalid header

Anyone know what I’m possibly doing wrong?
Note: I have confirmed that there are backups in my /home/dmitry/dgraph/backups folder

Any help would be appreciated :slight_smile:
Note: I’m on an Ubuntu machine at the moment, and I have encryption + ACL enabled.

Hi @dmitry, Thanks for reaching out. Can you please elaborate on a few things so that we might understand it better and help you.

  1. Which version of Dgraph are you using?
  2. Steps followed by you to reach here.
  3. Are you facing it every time you do this or just one or some times?
1 Like


  1. Using the master branch
  2. Started Dgraph Zero with ./dgraph zero, then start Dgraph Alpha with ./dgraph alpha --lru_mb=2048 --tls_dir=tls --acl_secret_file acl_key_file --encryption_key_file enc_key_file, then created a backup through Dgraph Ratel at /home/dmitry/dgraph/backups, and finally ./dgraph restore -p /home/dmitry/dgraph/dgraph -l /home/dmitry/dgraph/backups -z localhost:5080 --backup_id lucid_darwin0
  3. And yes I get the error every time

You need to pass the encryption key to the restore command. Otherwise the gzip reader is decompressing the data but the encrypted data is not in the format that gzip expects.

Look into the --encryption_key_file option in dgraph restore.

EDIT: The reason is that backups created in encrypted alphas are also written using the encryption key.


That is correct. Your backup may be encrypted.

Another way to check is the MANIFEST file in the backup folder. It should show “encrypted:true” that indicates the backup was encrypted.

Thanks @martinmr that solved it! I think that should be added to the documentation under the section of the docs :slight_smile: I almost thought about adding --encryption_key_file but I wasn’t sure :smiley:

Thanks also to @minhaj and @Paras for your help :slight_smile:

Thanks for pointing that out. I opened Document --encryption_key_file option in dgraph restore command. by martinmr · Pull Request #5638 · dgraph-io/dgraph · GitHub to fix our documentation.

1 Like