Fix "pg_dump: aborting because of server version mismatch" on Windows

pg_dump must be at least as new as the server. Here's how to find which pg_dump you're actually running and fix it.

Updated October 14, 2026 · 2 min read

Short on time? PostgresBackup does everything on this page from a Windows app: scheduled pg_dump backups, retention and one-click restores. Download it free.

The full error looks like this:

Text
pg_dump: error: aborting because of server version mismatch
pg_dump: detail: server version: 17.4; pg_dump version: 16.8

Why it happens

pg_dump can back up servers older than itself (all the way back to PostgreSQL 9.2) but refuses servers newer than itself. Each major version can add features and catalog changes an older pg_dump doesn't know about, and it would rather stop than produce an incomplete backup. Only the major version matters: pg_dump 17.0 dumps a 17.6 server fine.

It usually shows up when:

  • your hosting provider upgraded the database (Supabase, Neon, RDS and others move to new major versions),
  • you created a new database on a newer version than your local install, or
  • Windows is picking up an old pg_dump first, even though a newer one is installed.

Step 1: See which pg_dump you're running

PowerShell
Get-Command pg_dump.exe -All | Select-Object Source
& pg_dump --version

The first line lists every pg_dump.exe on your PATH, in the order Windows tries them. The first one wins. It's common to find an old C:\Program Files\PostgreSQL\12\bin ahead of a newer 17\bin, or a copy that came with pgAdmin or another tool.

To see what's installed regardless of PATH:

PowerShell
Get-ChildItem 'C:\Program Files\PostgreSQL\*\bin\pg_dump.exe' | ForEach-Object { '{0}  {1}' -f $_.VersionInfo.ProductVersion, $_.FullName }

And the server's version, from any SQL client: SELECT version(); or SHOW server_version;.

Step 2: Fix it

Pick whichever fits:

  1. Call the right pg_dump by full path. In scripts, this is the most robust fix:
PowerShell
& 'C:\Program Files\PostgreSQL\17\bin\pg_dump.exe' -h myhost -U myuser -F c -f backup.dump mydb
  1. Install newer client tools. If you don't have a new enough version, install the latest PostgreSQL's Command Line Tools only. You don't need the server. See how to install the PostgreSQL command-line tools on Windows. Newer tools back up older servers, so the newest release covers everything.
  2. Fix PATH order. In System Properties → Environment Variables, move the newest …\PostgreSQL\NN\bin above older ones (or remove old entries). Open a new terminal afterwards.

The backup script in the main Windows guide avoids the problem entirely: it searches Program Files\PostgreSQL and uses the newest pg_dump it finds, whatever PATH says.

The restore side: "unsupported version in file header"

The reverse problem shows up when restoring:

Text
pg_restore: error: unsupported version (1.16) in file header

A custom-format dump made by a newer pg_dump can't be read by an older pg_restore. Use a pg_restore at least as new as the pg_dump that made the file. The server you restore into can be older: pg_restore 18 restores into a PostgreSQL 15 server, as long as the dump doesn't use features that server lacks.

How PostgresBackup avoids this

PostgresBackup ships with the PostgreSQL 18 client tools, and if your PC has a newer PostgreSQL installed, it uses that instead. It always picks the newest pg_dump, pg_restore and psql together from one folder. If a server is ever newer than every pg_dump available, the error explains what to do (usually: install the latest PostgresBackup update) instead of only showing pg_dump's message.

The shortcut

Rather not maintain a backup script?

PostgresBackup is a Windows app that does all of this for you, with nothing to script and nothing to remember.

  • Scheduled pg_dump backups from a background service that starts with Windows
  • Keep the last N files plus hourly, daily, weekly, monthly and yearly copies
  • Restore any backup, or clone a database to another server, in a few clicks
  • PostgreSQL client tools included; standard .dump files, no lock-in
  • No account, no subscription, nothing leaves your machine

Clones, restores and manual backups are free. Scheduled backups are free for 14 days, then $9.99 once (launch price; $24 from January 1).