diff --git a/invokeai/app/services/model_records/model_records_sql.py b/invokeai/app/services/model_records/model_records_sql.py index 9d4892a141..7fad1761cc 100644 --- a/invokeai/app/services/model_records/model_records_sql.py +++ b/invokeai/app/services/model_records/model_records_sql.py @@ -292,14 +292,19 @@ class ModelRecordServiceSQL(ModelRecordServiceBase): for row in result: try: model_config = ModelConfigFactory.make_config(json.loads(row[0]), timestamp=row[1]) - except pydantic.ValidationError: + except pydantic.ValidationError as e: # We catch this error so that the app can still run if there are invalid model configs in the database. # One reason that an invalid model config might be in the database is if someone had to rollback from a # newer version of the app that added a new model type. row_data = f"{row[0][:64]}..." if len(row[0]) > 64 else row[0] + try: + name = json.loads(row[0]).get("name", "") + except Exception: + name = "" self._logger.warning( - f"Found an invalid model config in the database. Ignoring this model. ({row_data})" + f"Skipping invalid model config in the database with name {name}. Ignoring this model. ({row_data})" ) + self._logger.warning(f"Validation error: {e}") else: results.append(model_config)