# RuntimeError: No application found. Either you forgot to pass an app, or you tried to access the app before it was created.

- **ID:** `python/starlette-runtime-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Starlette 应用实例未正确初始化或未传递给服务器。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   确保应用实例在模块级别定义，并正确传递给 uvicorn。
   ```
2. **** (90% success)
   ```
   使用 uvicorn.run(app, host='0.0.0.0', port=8000)。
   ```
3. **** (85% success)
   ```
   检查导入语句，确保路径正确。
   ```

## Dead Ends

- **** — 在模块级别访问 app，但应用在函数内创建。 (80% fail)
- **** — 忘记在 uvicorn 中传递 app 对象。 (70% fail)
- **** — 使用错误的导入路径。 (60% fail)
