It looks as though you have a problem in system_administrator_group_id(). Looking at its definition within www/doc/sql/user-groups.sql, I wonder what does "select * from administration_info" return? (All of this appears to tell you what's broken, but not why or how it broke of course.)