Skip to content

Python: [Bug]: aiohttp.http_exceptions.LineTooLong: 400, message: Got more than 524288 bytes when reading: b'data: #7257

Description

Description

Hi
I am calling the agent created using Copilot Studio.
Whenever I make a request to the Salesforce connector , it gives the following issue -

Code Sample

import asyncio
from agent_framework.microsoft import CopilotStudioAgent
from msal import PublicClientApplication, ConfidentialClientApplication
import traceback

async def main():        

    agent = CopilotStudioAgent(
        environment_id=ENVIRONMENT_ID,
        agent_identifier="new_sf",
        tenant_id=TENANT_ID,
        client_id=CLIENT_ID,
        token=TOKEN
    )


    try:
        result = await agent.run("hi")
        print(f"Result: {result}")
        result1 = await agent.run("tell me the open opportunities in salesforce")
        print(f"Result: {result1}")
    except Exception as e:
        traceback.print_exc()

asyncio.run(main())

Error Messages / Stack Traces

result1 = await agent.run("tell me the open opportunities in salesforce")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\agent_framework_copilotstudio\_agent.py", line 258, in _run_impl
    response_messages = [message async for message in self._process_activities(activities, streaming=False)]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\agent_framework_copilotstudio\_agent.py", line 330, in _process_activities
    async for activity in activities:
    ...<9 lines>...
            )
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\microsoft_agents\copilotstudio\client\copilot_client.py", line 78, in ask_question
    async for activity in self.ask_question_with_activity(activity):
        yield activity
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\microsoft_agents\copilotstudio\client\copilot_client.py", line 105, in ask_question_with_activity
    async for activity in self.post_request(url, data, headers):
        yield activity
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\microsoft_agents\copilotstudio\client\copilot_client.py", line 39, in post_request
    async for line in response.content:
    ...<9 lines>...
            yield activity
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\aiohttp\streams.py", line 46, in __anext__
    rv = await self.read_func()
         ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\aiohttp\streams.py", line 370, in readline
    return await self.readuntil(max_size=max_line_length)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Z00583RM\Documents\tech\mafcs\.venv\Lib\site-packages\aiohttp\streams.py", line 401, in readuntil
    raise LineTooLong(chunk[:100] + b"...", max_size)
aiohttp.http_exceptions.LineTooLong: 400, message:
  Got more than 524288 bytes when reading: b'data: {"type":"event","id":"3da033af-d972-49d7-9880-628da9340178","timestamp":"2026-07-22T11:33:41.3...'.

Package Versions

agent-framework - 1.10.0, agent-framework-copilotstudio - 1.0.0b260521

Python Version

3.14.3

Additional Context

No response

Activity

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

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions