{
  "id": "python/starlette-runtime-error",
  "signature": "RuntimeError: No application found. Either you forgot to pass an app, or you tried to access the app before it was created.",
  "signature_zh": "RuntimeError: 未找到应用。可能忘记传递 app，或在应用创建前尝试访问。",
  "regex": "RuntimeError:\\ No\\ application\\ found\\.\\ Either\\ you\\ forgot\\ to\\ pass\\ an\\ app,\\ or\\ you\\ tried\\ to\\ access\\ the\\ app\\ before\\ it\\ was\\ created\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Starlette 应用实例未正确初始化或未传递给服务器。",
  "root_cause_type": "generic",
  "root_cause_zh": "Starlette 应用实例未正确初始化或未传递给服务器。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "在模块级别访问 app，但应用在函数内创建。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "忘记在 uvicorn 中传递 app 对象。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "使用错误的导入路径。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "确保应用实例在模块级别定义，并正确传递给 uvicorn。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "使用 uvicorn.run(app, host='0.0.0.0', port=8000)。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "检查导入语句，确保路径正确。",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}