I used the Bitnami stack and installed as non-root user psql. On using psql I did receive the mentioned error.
Turns out, there are 2 versions of psql
You might want to change the alias of the psql, so that it points to the non-root user.
alias psql='/bitnami/postgresql/postgresql/bin/psql'
The above worked for me on doing psql -U postgres