From: gliatti (@gliatti) <noreply+gliatti@github.com>
To: pgbackrest/pgbackrest <noreply+pgbackrest-pgbackrest@github.com>
Subject: [pgbackrest/pgbackrest] issue #2919: Question: archive-get fails on a standby with an unused pg2-host
Date: Thu, 12 Nov 2026 14:00:16 +0000
Message-ID: <gh-pgbackrest-pgbackrest-2919@github.com> (raw)
Hello,
<!-- Brouillon d'issue pour https://github.com/pgbackrest/pgbackrest/issues/new — à poster par Robin. Aucune donnée client. -->
**Title:** Question: archive-get fails on a standby with an unused pg2-host
---
### Context
A standby whose repository is hosted on the primary. The standby's `pgbackrest.conf` also listed the primary as a remote `pg` host (`pg2`). `restore_command` was `pgbackrest --stanza=demo archive-get %f "%p"`.
When streaming replication broke and the standby had to fall back on the archive, every `archive-get` failed.
### Reproduction (no PostgreSQL needed)
```ini
[global]
repo1-host=pg-primary
repo1-path=/var/lib/pgbackrest
[demo]
pg1-path=/var/lib/postgresql/13/main
pg2-host=pg-primary
pg2-path=/var/lib/postgresql/13/main
```
Output with 2.59.0 (2.41 behaves the same):
```
$ pgbackrest --stanza=demo archive-get 000000010000000000000001 /tmp/x
ERROR: [027]: pg and repo hosts cannot both be configured as remote
$ pgbackrest --stanza=demo --reset-pg2-host archive-get 000000010000000000000001 /tmp/x
ERROR: [055]: unable to open missing file '/var/lib/postgresql/13/main/global/pg_control' for read
```
The second error is expected in a container without a data directory: the configuration is accepted once `pg2-host` is reset. It is also accepted when `repo1-host` is removed and `pg2-host` is kept.
### What confused me
The original configuration had the remote primary as `pg1` and the local cluster as `pg2`. I knew about the `[072] archive-get command must be run on the PostgreSQL host` check, which only looks at pg1, so I swapped the indexes to make `pg1` local. The error stayed exactly the same, because the `[027]` check in `src/config/load.c` loops over every pg index and runs first.
### Questions
1. Is it intended that this check applies to `archive-get` and `archive-push`? As far as I can tell these commands never connect to a remote pg host, so `pg2-host` is not used by them.
2. Is there a case where a `pgN-host` is legitimate on a PostgreSQL host that uses a remote repository? The user guide says "no pg1-host should be configured" on PostgreSQL hosts: does that apply to every index?
3. Would it make sense for the message to name the options involved (here `pg2-host` and `repo1-host`)? It would have saved me some time.
Following up my last question #1832.
Robin from Dalibo,