mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(graph): prevent SQL crash on empty LLM registry during migration
migrate_llm_models was generating invalid SQL 'NOT IN ()' when the LLM registry is empty (e.g., fresh deployment before seeding). This causes a fatal PostgreSQL error and prevents server startup. Skip the migration with a warning if enum_values is empty.
This commit is contained in:
@@ -1667,6 +1667,12 @@ async def migrate_llm_models(migrate_to: LlmModel):
|
||||
from backend.data import llm_registry
|
||||
|
||||
enum_values = list(llm_registry.get_all_model_slugs_for_validation())
|
||||
|
||||
# Skip migration if registry is empty (fresh deployment before seeding)
|
||||
if not enum_values:
|
||||
logger.warning("LLM registry is empty, skipping model migration")
|
||||
return
|
||||
|
||||
escaped_enum_values = repr(tuple(enum_values)) # hack but works
|
||||
|
||||
# Update each block
|
||||
|
||||
Reference in New Issue
Block a user