I have postgres 14 running on Windows 2019 server and I am using pg_basebackup to take regular backups.

The same powershell script which was working last week suddenly started giving me below errors. No changes happened in the system except a host reboot.

For testing purposes, I tried giving full access to everyone to the both data directory/backup directory and still the same error.

PS G:\FULL_Backup> Start-Process -FilePath "C:\Program Files\PostgreSQL\14\bin\pg_basebackup.exe" -ArgumentList "-D G:\FULL_Backup\PG_Basebackup_2022-05-16_085816", "-Ft", "-z", "-R", "-U postgres", "-w" -Wait -NoNewWindow
pg_basebackup: error: could not initiate base backup: ERROR:  could not stat file or directory "./base/18119/43980": Permission denied
pg_basebackup: removing contents of data directory "G:\FULL_Backup\PG_Basebackup_2022-05-16_085816"

Thanks, Udhayan

  • It looks like that is an error which occurred on the db server which is just reported back to the client (pg_restore). Look in the db server's log file to see if there is more info.
    – jjanes
    Commented May 16, 2022 at 14:45
  • Log file does not have much information ERROR: could not stat file or directory "./base/18119/43980": Permission denied STATEMENT: BASE_BACKUP LABEL 'pg_basebackup base backup' PROGRESS NOWAIT TABLESPACE_MAP MANIFEST 'yes' Commented May 16, 2022 at 18:10

1 Answer 1


The database server cannot read one of its own files, which should never happen. You have to fix that condition.

Probably causes for that are:

  • You are running a virus scanner on the data directory that locks the file. Don't do that.

  • You changed ownership or permissions on that file. You should never modify anything in the data directory.

  • hmm ok Laurenz ..let me check if crowdstrike is the cause. but it was running last week as well that why i am surprised. Commented May 16, 2022 at 18:11
  • If it is a virus scanner, the problem would be intermittent. Commented May 17, 2022 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.