python runtime_error ai_generated true

starlette.exceptions.HTTPException:404: 未找到

starlette.exceptions.HTTPException: 404: Not Found

ID: python/starlette-http-exception

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-07-15首次发现

版本兼容性

版本状态引入弃用备注
0.30.x active
0.40.x active

根因分析

未找到路由或资源;当没有匹配的路由时由 Starlette 引发。

English

A route or resource is not found; raised by Starlette when no matching route exists.

generic

解决方案

  1. 95% 成功率
    Check `app.routes` or the OpenAPI docs at /docs.
  2. 90% 成功率
    app.include_router(router, prefix='/api/v1')

无效尝试

常见但无效的做法:

  1. 70% 失败

    Masks the 404 but doesn't fix the missing route or typo.

  2. 90% 失败

    Debug mode shows traceback but doesn't resolve missing route.