This can be caused by an incorrect host name in /etc/sourceforge.properties. Rebuilding runtime will correct this, assuming the hostname is set correctly in the site-options.conf file.
This issue can occur when using the restore.py script to restore data from a TeamForge instance with a different hostname.