# RuntimeError: No application found. Either you are not running inside a Starlette application or you have not set the 'app' variable.

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

## Root Cause

试图在 Starlette 应用上下文之外使用 request 或 response 对象。

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   from starlette.requests import Request
@app.route('/')
async def index(request: Request):
    return JSONResponse({'message': 'Hello'})
   ```

## Dead Ends

- **** — request 对象依赖于请求上下文，无法在全局创建 (95% fail)
- **** — 没有正确初始化上下文，仍然会报错 (80% fail)
