Skip to content

fastmcp.run() runtimeerror: task group is not initialized. make sure to use run(). #1372

Closed as not planned

Description

@SinDongHwan

Initial Checks

Description

following error sometime occur.

fastmcp.run() runtimeerror: task group is not initialized. make sure to use run().

Example Code

from mcp.server.fastmcp import FastMCP
# FastMCP instance
mcp = FastMCP(
    name=setting.server["name"],
    host=setting.server["host"],
    port=setting.server["port"],
    streamable_http_path=setting.server["streamable_http_path"],
    api_route="/mcp/",
    debug=True,
)
try:
    mcp.run(transport="streamable-http")
except KeyboardInterrupt:
    logger.info("Service shut down")

Python & MCP Python SDK

mcp version (1.13.1)

Activity

  1. added
    bugSomething isn't working
    ready for workEnough information for someone to start working on
    P1Significant bug affecting many users, highly requested feature
    on Oct 3, 2025
  2. added this to the FastMCP issues milestone on Oct 3, 2025
  3. ChenyangLi4288 commented on Oct 10, 2025

    @ChenyangLi4288

    I can't reproduce this one.

  4. added
    needs reproneeds additional information to be able to reproduce bug
    and removed
    ready for workEnough information for someone to start working on
    P1Significant bug affecting many users, highly requested feature
    on Oct 13, 2025
  5. felixweinberger commented on Oct 13, 2025

    @felixweinberger
    Contributor

    I can't reproduce this one.

    I was also unable to reproduce this - could you provide any more information about your setup? Are you running into this issue with just the example code given and running python -m main.py?

  6. tugbayatilla commented on Oct 29, 2025

    @tugbayatilla

    i just copy and paste this code block, and got the same result.

    https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_multiple_servers.py

    i have just installed these 2 packages
    mcp[cli]
    ally-ai-core

    python: 3.12

    `Package Version


    ally-ai-core 0.7.0
    annotated-types 0.7.0
    anyio 4.11.0
    attrs 25.4.0
    certifi 2025.10.5
    click 8.3.0
    h11 0.16.0
    httpcore 1.0.9
    httpx 0.28.1
    httpx-sse 0.4.3
    idna 3.11
    jsonschema 4.25.1
    jsonschema-specifications 2025.9.1
    markdown-it-py 4.0.0
    mcp 1.19.0
    mdurl 0.1.2
    pip 25.3
    pydantic 2.12.3
    pydantic_core 2.41.4
    pydantic-settings 2.11.0
    Pygments 2.19.2
    python-dotenv 1.2.1
    python-multipart 0.0.20
    PyYAML 6.0.3
    referencing 0.37.0
    rich 14.2.0
    rpds-py 0.28.0
    shellingham 1.5.4
    sniffio 1.3.1
    sse-starlette 3.0.2
    starlette 0.49.1
    typer 0.20.0
    typing_extensions 4.15.0
    typing-inspection 0.4.2
    uvicorn 0.38.0
    `

  7. maxisbey commented on Aug 10, 2026

    @maxisbey
    Contributor

    Thanks for the report. I'm closing this out as part of a backlog cleanup now that v2 is out. Feel free to reopen if this is still relevant.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds reproneeds additional information to be able to reproduce bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions