From d64427d726685f8687bd7400041b16fce2170c95 Mon Sep 17 00:00:00 2001 From: "Stefan Hladnik (aider)" Date: Tue, 18 Mar 2025 03:49:59 +0700 Subject: [PATCH] feat: Add error handling for unavailable model in response text --- aider/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aider/models.py b/aider/models.py index 749b2c79c..dc55e0a8a 100644 --- a/aider/models.py +++ b/aider/models.py @@ -246,6 +246,9 @@ class ModelInfoManager: if response.status_code != 200: return {} html = response.text + if f'The model "{url_part}" is not available' in html: + print(f"Error: Model '{url_part}' is not available") + sys.exit(1) import re text = re.sub(r'<[^>]+>', ' ', html) context_match = re.search(r"([\d,]+)\s*context", text)