diff --git a/aider/sendchat.py b/aider/sendchat.py index 5e75ff584..837b3b853 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -60,7 +60,7 @@ def ensure_alternating_roles(messages): prev_role = None for msg in messages: - current_role = msg['role'] + current_role = msg.get('role') # Get 'role', None if missing # If the current role is the same as the previous, insert an empty message of the opposite role if current_role == prev_role: