{
  "id": "python/starlette-runtime-error-no-application",
  "signature": "RuntimeError: No application found. Either you are not running inside a Starlette application or you have not set the 'app' variable.",
  "signature_zh": "运行时错误：未找到应用程序。要么您不在 Starlette 应用程序中运行，要么未设置 'app' 变量。",
  "regex": "RuntimeError:\\ No\\ application\\ found\\.\\ Either\\ you\\ are\\ not\\ running\\ inside\\ a\\ Starlette\\ application\\ or\\ you\\ have\\ not\\ set\\ the\\ 'app'\\ variable\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "试图在 Starlette 应用上下文之外使用 request 或 response 对象。",
  "root_cause_type": "generic",
  "root_cause_zh": "试图在 Starlette 应用上下文之外使用 request 或 response 对象。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "request 对象依赖于请求上下文，无法在全局创建",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "没有正确初始化上下文，仍然会报错",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "from starlette.requests import Request\n@app.route('/')\nasync def index(request: Request):\n    return JSONResponse({'message': 'Hello'})",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}