One of the reason could be that
unix_socket_directories in postgresql.conf file is not listed with the directory it is looking for.
In the question example it is looking for directory /tmp this has to be provided in the postgresql.conf file
something like this:
unix_socket_directories = '/var/run/postgresql,/tmp' # comma-separated list of directories
This solution worked for me.