-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
Description
When running our FastAPI application in development mode, the startup fails with:
ValueError: Can't patch loop of type <class 'uvloop.Loop'>
This is raised by nest_asyncio.apply() inside our plugin loader, because uvicorn defaults to uvloop, which nest_asyncio cannot patch.
Reproduction Steps
- Clone the repo and enter the backend directory:
cd agent-based-platform-backend/backend
- Activate virtual environment and install dependencies.
- Start the server in dev mode:
fastapi dev main.py
- Observe the error in the reloader subprocess:
File ".../plugin/tools.py", line 93, in parse_plugin_config
nest_asyncio.apply()
File ".../nest_asyncio.py", line 19, in apply
_patch_loop(loop)
File ".../nest_asyncio.py", line 193, in _patch_loop
raise ValueError('Can't patch loop of type %s' % type(loop))
ValueError: Can't patch loop of type <class 'uvloop.Loop'>
Additional Context
This issue is analogous to NVIDIA’s NeMo-Guardrails GitHub issue #112, where maintainers suggest using DISABLE_NEST_ASYNCIO=True or --loop asyncio.
Metadata
Metadata
Assignees
Labels
No labels