“pg_basebackup: error: could not send replication command “TIMELINE_HISTORY”: ERROR: could not open file “pg_wal/00000002.history”: No such file or directory”
You may have encountered the above error when you run the pg_basebackup command.
You are getting this error because you don’t have “00000002.history” file in your pg_wal directory. This file can sometimes be accidentally deleted by dba.

“pg_wal/00000002.history” if you’re wondering what this file is for. I recommend you to look at this link.
There is a very simple solution to this.
Solution:
You can solve your problem by creating this file in the pg_wal folder.
touch 00000002.history


Click for detailed information about PostgreSQL Troubleshooting Service

