From 6cf8b0daedb78a4eb13d9e256944ab4c686d0e29 Mon Sep 17 00:00:00 2001 From: Krzysztof Czerwinski Date: Wed, 28 Feb 2024 16:35:31 +0100 Subject: [PATCH] Fix trying to load non-existing agent --- autogpts/autogpt/autogpt/app/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autogpts/autogpt/autogpt/app/main.py b/autogpts/autogpt/autogpt/app/main.py index 20f1d98724ff..47908a3addb6 100644 --- a/autogpts/autogpt/autogpt/app/main.py +++ b/autogpts/autogpt/autogpt/app/main.py @@ -164,7 +164,12 @@ async def run_auto_gpt( if re.match(r"^\d+$", load_existing_agent): load_existing_agent = existing_agents[int(load_existing_agent) - 1] elif load_existing_agent and load_existing_agent not in existing_agents: - raise ValueError(f"Unknown agent '{load_existing_agent}'") + logger.info( + f"Unknown agent '{load_existing_agent}', " + f"creating a new one instead.", + extra={"color": Fore.YELLOW}, + ) + load_existing_agent = "" # Either load existing or set up new agent state agent = None