Skip to content

fix: remove unsupported max_line_length arg from aiohttp readline()#2488

Open
SeleneXX wants to merge 1 commit into
googleapis:mainfrom
SeleneXX:patch-2
Open

fix: remove unsupported max_line_length arg from aiohttp readline()#2488
SeleneXX wants to merge 1 commit into
googleapis:mainfrom
SeleneXX:patch-2

Conversation

@SeleneXX
Copy link
Copy Markdown

Fixes #2487

Regression introduced in #2437.

Problem:
google-genai 2.5.0 crashes when streaming with aiohttp installed:
TypeError: StreamReader.readline() got an unexpected keyword argument 'max_line_length'

Root cause:
aiohttp.StreamReader.readline() does not accept any parameters. Its signature is:

async def readline(self) -> bytes:
    return await self.readuntil()

The max_line_length keyword argument passed in _api_client.py is invalid for all released versions of aiohttp.

Why this is safe: The line-length limit is already governed by the limit parameter of StreamReader, which is set correctly via read_bufsize=READ_BUFFER_SIZE when the aiohttp ClientSession is created.

Change: Remove the unsupported max_line_length keyword argument from the readline() call.

aiohttp.StreamReader.readline() does not accept any arguments. The line length limit is already controlled by read_bufsize set on the ClientSession
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 21, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this May 21, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:S Code changes < 10 lines label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S Code changes < 10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: StreamReader.readline() got an unexpected keyword argument 'max_line_length' when streaming with aiohttp

2 participants