Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Route discovery fails when include_router is called with an indirect router reference

Open
#148 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
fastapi, python, typescript, vscode
Domain
api, devtools

Research direction

Reproduce the issue with the main.py and items.py examples, comparing direct and indirect include_router calls while checking the extension logs. Trace the FastAPI app discovery and include_router resolution path, then verify that routes from the included items router appear in the path explorer for both indirect examples.

Written by the indexing model from the issue text.

Description

bug
Description

The FastAPI extension fails to discover routes when app.include_router() is called with a router reference that is not a direct import name.

In the example only the route defined directly in main.py (GET /) is visible in the path explorer. All routes from the included router items are missing.

✅ Working example
Image
❌ Using indirect router reference
Image
Extension logs
2026-04-22 15:00:03.012 [info] Discovering FastAPI apps in 1 workspace folder(s)...
2026-04-22 15:00:03.041 [info] Found 1 candidate FastAPI file(s) in fastapi-extension
2026-04-22 15:00:03.044 [info] Analyzed "file://.../main.py": 1 routes, 1 routers, 1 include_router calls
2026-04-22 15:00:03.044 [info] Resolving include_router: router (prefix: {prefix})
2026-04-22 15:00:03.044 [info] No import found for router reference: router
2026-04-22 15:00:03.044 [info] Found 1 FastAPI app(s) with 1 route(s) in fastapi-extension
Repository link (if open source)

No response

Project structure
fastapi-extension/
├── items.py
└── main.py
FastAPI app and router setup
from fastapi import APIRouter, FastAPI
from items import router as items_router

app = FastAPI()

# Case 1 : Working
# app.include_router(items_router, prefix="/items", tags=["items"])

# Case 2 : Not working
routers: list[tuple[APIRouter, str, str]] = [
    (items_router, "/items", "items"),
]
for router, prefix, tag in routers:
    app.include_router(router, prefix=prefix, tags=[tag])

# Case 3 : Not working
# routers: list[tuple[APIRouter, str, str]] = [
#     (items_router, "/items", "items"),
# ]
# app.include_router(routers[0][0], prefix=routers[0][1], tags=[routers[0][2]])


@app.get("/")
async def root():
    return {"message": "Hello World"}
VS Code version

1.116.0

FastAPI extension version

0.2.0

Python version

3.11.11

FastAPI version

0.115.12

Operating system

macOS 26.3.1 (a) (25D771280a)

Dominant language
TypeScript
Stars
336
Forks
28
Avg merge
1h 16m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.