Skip to content

anyio.NoEventLoopError when serving static files on Python 3.14 (dup of #2767) #2978

Description

@chouhandarsh

Describe the bug
Running a Chainlit app on Python 3.14 crashes on every request that serves a static file
(including the initial page load) with anyio.NoEventLoopError: Not currently running on any asynchronous event loop. Available async backends: asyncio, trio. The error originates
from starlette/responses.py calling anyio.to_thread.run_sync(os.stat, self.path).

To Reproduce

  1. Create a fresh virtual environment with Python 3.14
  2. pip install chainlit
  3. chainlit run app.py
  4. Open http://localhost:8000 in a browser
  5. See repeated anyio.NoEventLoopError tracebacks in the terminal

Screenshots

Image

**Desktop **

  • OS: Linux Fedora
  • Browser Chrome
  • Python version : 3.14.6
    chainlit version: 2.11.0

Additional context
This looks like a duplicate of #2767 — same traceback and root cause. Downgrading to
Python 3.12/3.13 in a fresh venv works around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triagestaleIssue has not had recent activity or appears to be solved. Stale issues will be automatically closed

    Type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions