{
  "id": "python/starlette-runtime-error-connection-refused",
  "signature": "RuntimeError: Connection refused: The server is not running or is unreachable.",
  "signature_zh": "RuntimeError: 连接被拒绝：服务器未运行或无法访问。",
  "regex": "RuntimeError:\\ Connection\\ refused:\\ The\\ server\\ is\\ not\\ running\\ or\\ is\\ unreachable\\.",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Attempting to connect to a Starlette server that is not started or is listening on a different host/port.",
  "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": "Checking only localhost without specifying port",
      "why_fails": "Server may be on a different port or bound to 0.0.0.0.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using wrong protocol (http vs https)",
      "why_fails": "If server uses SSL, http connections fail.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Start server with correct host and port",
      "success_rate": 0.9,
      "how": "uvicorn app:app --host 0.0.0.0 --port 8000\n# Then connect to http://localhost:8000",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check firewall and network settings",
      "success_rate": 0.8,
      "how": "sudo ufw status\n# Allow port if needed: sudo ufw allow 8000",
      "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-07-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}