In case when PythonPath is not provided then application server not started and server thread finished there execution, due to the above line of code Destructor of Server class has been called and we are accessing the function server->getError().length() at line no 251 of pgAdmin4.cpp, which cause the application crash.
I have removed that line and tested RM #3177 and RM# 3277, both are working fine.
Please review and test it.
So my first test was compiled against Python 3, but my config was still pointing at a Python 2 venv. I got the error below in the console of QtCreator.
Also, wouldn't it make more sense to move the connect that you removed so it only happens once the server is up and running? That way we will still ensure it gets properly deleted when appropriate, but not prematurely if an error occurs during startup.