Can you get into a rails console and then show us the following values:
BackupRestore.database_configuration
BackupRestore::DatabaseRestorer.psql_command
e.g.:
→ rails c
Loading development environment (Rails 7.0.8)
[1] pry(main)> BackupRestore.database_configuration
=> #<struct BackupRestore::DatabaseConfiguration
host=nil,
port=nil,
username="michael",
password=nil,
database="discourse_development">
[2] pry(main)> BackupRestore::DatabaseRestorer.psql_command
=> "psql --dbname='discourse_development' --single-transaction --variable=ON_ERROR_STOP=1 --username=michael"