mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-06 12:55:05 -05:00
fix: add exception handling for block instantiation in get_stats
Matches existing defensive pattern in get_missing_items() (lines 188-200). Prevents a single broken block from crashing the stats endpoint. Addresses CodeRabbit review comment.
This commit is contained in:
@@ -267,7 +267,11 @@ class BlockHandler(ContentHandler):
|
||||
# Filter out disabled blocks and excluded blocks - they're not indexed
|
||||
enabled_block_ids = []
|
||||
for block_id, block_cls in all_blocks.items():
|
||||
block_instance = block_cls()
|
||||
try:
|
||||
block_instance = block_cls()
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to instantiate block {block_id}: {e}")
|
||||
continue
|
||||
if block_instance.disabled:
|
||||
continue
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user