Skip to content

[Bug]: MCP WebSocket handler crashes: AttributeError: 'JSONRPCMessage' object has no attribute 'message' #1678

@pwpeterson

Description

@pwpeterson

crawl4ai version

0.7.8 (installed via git+https://github.com/unclecode/crawl4ai.git)

Expected Behavior

Description:
When connecting to the MCP WebSocket endpoint (/mcp/ws) on the current main branch, the server crashes immediately upon receiving the initialize request. This appears to be a regression caused by a mismatch between the mcp Python SDK version and the server's message handling logic.

Traceback from Container Logs:

text
Copy
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
Environment:

Crawl4AI Version: 0.7.8 (installed via git+https://github.com/unclecode/crawl4ai.git)
MCP SDK Version: 1.7.1
Deployment: Docker/Podman (Python 3.12-slim-bookworm)
Root Cause Analysis:
The mcp.shared.session._receive_loop in newer versions of the mcp library expects a SessionMessage wrapper (which has a .message attribute). However, the current WebSocket transport in Crawl4AI appears to be passing a raw JSONRPCMessage directly to the session, causing the AttributeError.

Current Behavior

When connecting to the MCP WebSocket endpoint (/mcp/ws) on the current main branch, the server crashes immediately upon receiving the initialize request. This appears to be a regression caused by a mismatch between the mcp Python SDK version and the server's message handling logic.

Is this reproducible?

Yes

Inputs Causing the Bug

Steps to Reproduce

1) Run the Crawl4AI Docker container from the latest main.
2) Attempt to connect via WebSocket to ws://localhost:11235/mcp/ws using a standard MCP client (or a script using mcp.client.websocket).
3) The connection will open and then immediately close/timeout as the server-side loop crashes.

Code snippets

The log was generated using this test script: 

# test_mcp_minimal.py
# Requires: uv pip install "mcp[ws]" anyio

import anyio
from mcp.client.websocket import websocket_client
from mcp.client.session import ClientSession


async def main() -> None:
    print("Connecting to ws://localhost:11235/mcp/ws")
    async with websocket_client("ws://localhost:11235/mcp/ws") as (r, w):
        print("WebSocket connected, creating ClientSession...")
        async with ClientSession(r, w) as s:
            print("Calling initialize() with 10s timeout...")
            try:
                # NOTE: use plain `with`, not `async with`
                with anyio.fail_after(10):
                    await s.initialize()
                print("initialize() OK, listing tools...")

                with anyio.fail_after(10):
                    tools = (await s.list_tools()).tools
                print("tools:", [t.name for t in tools])
            except TimeoutError:
                print("ERROR: initialize() or list_tools() timed out after 10s")
            except Exception as e:
                print("ERROR:", repr(e))


anyio.run(main)

OS

Ubuntu 24.04

Python version

Python 3.13.6

Browser

No response

Browser version

No response

Error logs & Screenshots (if applicable)

podman logs bcc58bf1b420 | tail -n 80
[2025-12-23 23:36:33 +0000] [4] [INFO] Starting gunicorn 23.0.0
[2025-12-23 23:36:33 +0000] [4] [INFO] Listening at: http://0.0.0.0:11235 (4)
[2025-12-23 23:36:33 +0000] [4] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2025-12-23 23:36:33 +0000] [5] [INFO] Booting worker with pid: 5
/app/job.py:35: UserWarning: Field name "schema" in "LlmJobPayload" shadows an attribute in parent "BaseModel"
class LlmJobPayload(BaseModel):
[2025-12-23 23:36:34 +0000] [5] [INFO] Started server process [5]
[2025-12-23 23:36:34 +0000] [5] [INFO] Waiting for application startup.
[2025-12-23 23:36:34 +0000] [5] [INFO] Application startup complete.
[2025-12-23 23:55:43 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:01:51 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:05:15 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:09:35 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:24:47 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:27:03 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:32:47 +0000] [5] [ERROR] Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 79, in collapse_excgroups
    | yield
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 192, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
    | await super().call(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
    | await response(scope, wrapped_receive, send)
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
    | async for chunk in self.body_iterator:
    | File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
    | assert message["type"] == "http.response.body", f"Unexpected message: {message}"
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1135, in call
await super().call(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 107, in call
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in call
with recv_stream, send_stream, collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/usr/local/lib/python3.12/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
raise exc
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 194, in call
await response(scope, wrapped_receive, send)
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 232, in call
async for chunk in self.body_iterator:
File "/usr/local/lib/python3.12/site-packages/starlette/middleware/base.py", line 178, in body_stream
assert message["type"] == "http.response.body", f"Unexpected message: {message}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Unexpected message: {'type': 'http.response.start', 'status': 200, 'headers': [(b'content-length', b'4'), (b'content-type', b'application/json')]}
[2025-12-24 00:36:10 +0000] [5] [INFO] 10.89.0.47:53734 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 00:36:10 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 00:36:10 +0000] [5] [INFO] connection closed
[2025-12-24 00:38:03 +0000] [5] [INFO] 10.89.0.47:55172 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 00:38:03 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 00:38:03 +0000] [5] [INFO] connection closed
[2025-12-24 00:42:05 +0000] [5] [INFO] 10.89.0.47:40230 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 00:42:05 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 00:42:05 +0000] [5] [INFO] connection closed
[2025-12-24 00:44:49 +0000] [5] [INFO] 10.89.0.47:60418 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 00:44:49 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 00:44:49 +0000] [5] [INFO] connection closed
[2025-12-24 00:58:21 +0000] [5] [INFO] 10.89.0.47:32980 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 00:58:21 +0000] [5] [INFO] connection open
[2025-12-24 00:58:21 +0000] [5] [INFO] connection closed
[2025-12-24 01:00:49 +0000] [5] [INFO] 10.89.0.47:43112 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 01:00:49 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 01:00:49 +0000] [5] [INFO] connection closed
[2025-12-24 01:03:07 +0000] [5] [INFO] 10.89.0.47:44984 - "WebSocket /mcp/ws" [accepted]
[2025-12-24 01:03:07 +0000] [5] [INFO] connection open
ERROR:root:Unhandled exception in receive loop: 'JSONRPCMessage' object has no attribute 'message'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 360, in _receive_loop
elif isinstance(message.message.root, JSONRPCRequest):
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 1026, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'JSONRPCMessage' object has no attribute 'message'
[2025-12-24 01:03:07 +0000] [5] [INFO] connection closed
2025-12-23 23:36:31,807 INFO supervisord started with pid 1
2025-12-23 23:36:32,809 INFO spawned: 'gunicorn' with pid 4
2025-12-23 23:36:33,965 INFO success: gunicorn entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
MCP server running on 0.0.0.0:11235
[INIT].... → Crawl4AI 0.7.8
[FETCH]... ↓ https://example.com
| ✓ | ⏱: 0.33s
[SCRAPE].. ◆ https://example.com
| ✓ | ⏱: 0.00s
[COMPLETE] ● https://example.com
| ✓ | ⏱: 0.33s
[FETCH]... ↓ https://example.com
| ✓ | ⏱: 0.30s
[SCRAPE].. ◆ https://example.com
| ✓ | ⏱: 0.00s
[COMPLETE] ● https://example.com
| ✓ | ⏱: 0.30s
[FETCH]... ↓ https://example.com
| ✓ | ⏱: 0.37s
[SCRAPE].. ◆ https://example.com
| ✓ | ⏱: 0.00s
[COMPLETE] ● https://example.com
| ✓ | ⏱: 0.38s
[FETCH]... ↓ https://example.com
| ✓ | ⏱: 0.36s
[SCRAPE].. ◆ https://example.com
| ✓ | ⏱: 0.00s
[COMPLETE] ● https://example.com
| ✓ | ⏱: 0.36s
2025-12-23 23:43:45,222 INFO reaped unknown pid 137 (exit status 0)
2025-12-23 23:43:45,222 INFO reaped unknown pid 139 (exit status 0)
2025-12-23 23:43:45,223 INFO reaped unknown pid 142 (exit status 0)
2025-12-23 23:43:45,223 INFO reaped unknown pid 143 (exit status 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 BugSomething isn't working🩺 Needs TriageNeeds attention of maintainers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions