Why am I getting pg_restore: [archiver] unsupported version (1.xx) in file header error with pg_restore?

Issue

I get a pg_restore: [archiver] unsupported version (1.xx) in file header error when I try to restore a logical backup file that was created using Heroku PGBackups (heroku pg:backups:capture or scheduled backups) feature or using pg_dump with one-off dynos.

Resolution

This error indicate there's a PG version compatibility mis-match between the pg_restore binary and the logical backup(i.e. the PG version of the logical backup is either lower or higher than that of pg_restore). Please make sure that you are using the latest Postgres version. While we do support using either pg_dump and pg_restore with one-off dynos, they are subject to any version changes depending on our image updates.

You can check the pg_restore version you're using by running pg_restore --version.

If you are using an scheduled task or automation to take the logical backups/database dumps, you can modify the task to ensure that pg_dump and pg_restore are using the necessary version to take and restore the backup. This can be done by using the Apt buildpack to install the specific version libraries you need to use the compatible pg_dump and pg_restore versions.

If you are using a third-party tool, such as PgAdmin, to restore the provided dump file, the restore may not succeed even with the installed Postgres version being up to date. This is due to third-party tools often bundling their own versions of the pg_restore binary, that may not be up to date.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support