# HG changeset patch # User RhodeCode Admin # Date 2024-07-16 19:53:10 # Node ID 6ef12567480687c0db3ca49d389eeab91f97454d # Parent c6bd49366cb737c4ff20087eeffb2bf6aeb3b971 fix: startup, report nicer error in case DB is damaged or empty when starting services diff --git a/rhodecode/config/utils.py b/rhodecode/config/utils.py --- a/rhodecode/config/utils.py +++ b/rhodecode/config/utils.py @@ -102,6 +102,9 @@ def get_default_user_id(): result = session.execute(text( "SELECT user_id from users where username = :uname" ), {'uname': DEFAULT_USER}) - user_id = result.first()[0] + user = result.first() + if not user: + raise ValueError('Unable to retrieve default user data from DB') + user_id = user[0] return user_id