My PostgreSQL replica is behind with an error about max_connections.

A PostgreSQL replica’s max_connections setting must be greater than or equal to the primary’s setting; if the value is increased on the replica before being changed on the primary it will result in the replica becoming inaccessible with the following error:

FATAL:  hot standby is not possible because max_connections = 1000 is a
lower setting than on the master server (its value was 2000)

Our SRE Team is alerted when a replica fails for this reason, and will take action to correct the situation (generally by increasing max_connections on the replica and notifying the user).

To avoid this issue, you need to update max_connections on the replica Database to the higher value before updating the value on the primary.