Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fix case where index throws value error.

BillSchumacher66d316a19cb5
diff --git a/scripts/json_parser.py b/scripts/json_parser.py
index 1fd6824408..a7b6127f79 100644
--- a/scripts/json_parser.py
+++ b/scripts/json_parser.py
@@ -53,7 +53,7 @@ def fix_and_parse_json(
last_brace_index = json_str.rindex("}")
json_str = json_str[:last_brace_index+1]
return json.loads(json_str)
- except json.JSONDecodeError as e: # noqa: F841
+ except (json.JSONDecodeError, ValueError) as e: # noqa: F841
if try_to_fix_with_gpt:
print("Warning: Failed to parse AI output, attempting to fix."
"\n If you see this warning frequently, it's likely that"