Skip to content

fix: handle None content in get_cur_message_text - #5674

Open
dajiaohuang wants to merge 1 commit into
Aider-AI:mainfrom
dajiaohuang:fix/handle-none-content-in-get-cur-message-text
Open

fix: handle None content in get_cur_message_text#5674
dajiaohuang wants to merge 1 commit into
Aider-AI:mainfrom
dajiaohuang:fix/handle-none-content-in-get-cur-message-text

Conversation

@dajiaohuang

Copy link
Copy Markdown

Fixes #5649

Problem

When an assistant message has no text content (e.g., image-only responses or rejections), msg[content] is None. This causes a TypeError in get_cur_message_text() when attempting string concatenation with None.

Solution

Added a null check before concatenating message content:

if msg["content"] is not None:
    text += msg["content"] + "\n"

Test

Added test cases in tests/basic/test_coder.py to verify handling of messages with None content.

Fixes Aider-AI#5649 - TypeError when assistant message has no text content (e.g. image-only or rejection responses)
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught TypeError in base_coder.py line 675

2 participants