Route discovery fails when include_router is called with an indirect router reference
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
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
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
❌ Using indirect router reference
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug:new
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
callstackincubator/simlock#350 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openwatersio/maritime-zones#33 ·
Maintainers usually reply within 1 day
-
Booking email verification fails for plus aliases with impersonation protection enabledPossibly taken @kankadev claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
calcom/cal.diy#30293 · 1 comment ·
Maintainers usually reply within 5 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/DebateAI#611 ·
Maintainers usually reply within 3 days